basyx-typescript-sdk 2.2.4 → 2.2.5

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 (58) hide show
  1. package/README.md +115 -0
  2. package/bundle/index.cjs +2479 -1814
  3. package/bundle/index.cjs.map +1 -1
  4. package/bundle/index.mjs +2479 -1814
  5. package/bundle/index.mjs.map +1 -1
  6. package/dist/clients/AasDiscoveryClient.d.ts +3 -2
  7. package/dist/clients/AasDiscoveryClient.js +78 -20
  8. package/dist/clients/AasRegistryClient.d.ts +4 -2
  9. package/dist/clients/AasRegistryClient.js +153 -45
  10. package/dist/clients/AasRepositoryClient.d.ts +73 -16
  11. package/dist/clients/AasRepositoryClient.js +682 -263
  12. package/dist/clients/AasxFileClient.d.ts +18 -0
  13. package/dist/clients/AasxFileClient.js +100 -25
  14. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +3 -1
  15. package/dist/clients/ConceptDescriptionRepositoryClient.js +93 -29
  16. package/dist/clients/SubmodelRegistryClient.d.ts +3 -1
  17. package/dist/clients/SubmodelRegistryClient.js +91 -21
  18. package/dist/clients/SubmodelRepositoryClient.d.ts +229 -22
  19. package/dist/clients/SubmodelRepositoryClient.js +689 -201
  20. package/dist/generated/AasDiscoveryService/models/index.d.ts +2 -2
  21. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +1 -1
  22. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +1 -1
  23. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +1 -1
  24. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +1 -1
  25. package/dist/generated/AasRegistryService/index.d.ts +1 -1
  26. package/dist/generated/AasRegistryService/index.js +1 -1
  27. package/dist/generated/AasRegistryService/models/index.d.ts +3 -3
  28. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +3 -3
  29. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1 -1
  30. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +1 -1
  31. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +1 -1
  32. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +1 -1
  33. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +1 -1
  34. package/dist/generated/AasRepositoryService/index.d.ts +1 -1
  35. package/dist/generated/AasRepositoryService/index.js +1 -1
  36. package/dist/generated/AasRepositoryService/models/index.d.ts +7 -7
  37. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +5 -3
  38. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +6 -0
  39. package/dist/generated/AasxFileService/apis/DescriptionAPIApi.d.ts +26 -0
  40. package/dist/generated/AasxFileService/apis/DescriptionAPIApi.js +40 -0
  41. package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
  42. package/dist/generated/AasxFileService/apis/index.js +1 -0
  43. package/dist/generated/AasxFileService/models/index.d.ts +45 -0
  44. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2 -2
  45. package/dist/generated/SubmodelRegistryService/models/index.d.ts +2 -2
  46. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +9 -9
  47. package/dist/generated/runtime.js +7 -0
  48. package/dist/lib/errorHandler.js +13 -2
  49. package/dist/models/api.d.ts +4 -2
  50. package/dist/services/AasService.d.ts +21 -1
  51. package/dist/services/AasService.js +114 -26
  52. package/dist/services/SubmodelService.d.ts +21 -1
  53. package/dist/services/SubmodelService.js +119 -21
  54. package/package.json +14 -3
  55. package/dist/generated/AasRegistryService/runtime.d.ts +0 -181
  56. package/dist/generated/AasRegistryService/runtime.js +0 -326
  57. package/dist/generated/AasRepositoryService/runtime.d.ts +0 -181
  58. package/dist/generated/AasRepositoryService/runtime.js +0 -326
@@ -4,6 +4,7 @@ import type { AssetId } from '../models/AssetId';
4
4
  import { AasDiscoveryService } from '../generated';
5
5
  import { Configuration } from '../generated/runtime';
6
6
  export declare class AasDiscoveryClient {
7
+ private static extractStatusCode;
7
8
  /**
8
9
  * Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
9
10
  *
@@ -11,7 +12,7 @@ export declare class AasDiscoveryClient {
11
12
  * - configuration: The http request options
12
13
  * - assetIds?: A list of specific Asset identifiers
13
14
  * - 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
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
15
16
  *
16
17
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
17
18
  */
@@ -72,7 +73,7 @@ export declare class AasDiscoveryClient {
72
73
  * - configuration: The http request options
73
74
  * - assetLink?: A list of specific Asset identifiers
74
75
  * - limit?: The maximum number of elements in the response array
75
- * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
76
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
76
77
  *
77
78
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
78
79
  */
@@ -1,9 +1,25 @@
1
1
  import { AasDiscoveryService } from '../generated';
2
+ import { RequiredError } from '../generated/runtime';
2
3
  import { applyDefaults } from '../lib/apiConfig';
3
4
  import { base64Encode } from '../lib/base64Url';
4
5
  import { convertApiAssetIdToCoreAssetId, convertCoreAssetIdToApiAssetId } from '../lib/convertAasDiscoveryTypes';
5
6
  import { handleApiError } from '../lib/errorHandler';
6
7
  export class AasDiscoveryClient {
8
+ static extractStatusCode(err, parsedError) {
9
+ const responseStatus = err?.response?.status;
10
+ if (typeof responseStatus === 'number') {
11
+ return responseStatus;
12
+ }
13
+ if (err instanceof RequiredError || err?.name === 'RequiredError') {
14
+ return 400;
15
+ }
16
+ const code = parsedError?.messages?.[0]?.code;
17
+ if (!code) {
18
+ return undefined;
19
+ }
20
+ const parsedCode = Number.parseInt(code, 10);
21
+ return Number.isNaN(parsedCode) ? undefined : parsedCode;
22
+ }
7
23
  /**
8
24
  * Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
9
25
  *
@@ -11,7 +27,7 @@ export class AasDiscoveryClient {
11
27
  * - configuration: The http request options
12
28
  * - assetIds?: A list of specific Asset identifiers
13
29
  * - 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
30
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
15
31
  *
16
32
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
17
33
  */
@@ -20,20 +36,27 @@ export class AasDiscoveryClient {
20
36
  try {
21
37
  const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
22
38
  const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify(id)));
23
- const result = await apiInstance.getAllAssetAdministrationShellIdsByAssetLink({
39
+ const response = await apiInstance.getAllAssetAdministrationShellIdsByAssetLinkRaw({
24
40
  assetIds: encodedAssetIds,
25
41
  limit: limit,
26
42
  cursor: cursor,
27
43
  });
44
+ const result = await response.value();
28
45
  const shellIds = result.result ?? [];
46
+ const pagedResult = result.paging_metadata;
29
47
  return {
30
48
  success: true,
31
- data: { pagedResult: result.pagingMetadata, result: shellIds },
49
+ data: { pagedResult, result: shellIds },
50
+ statusCode: response.raw.status,
32
51
  };
33
52
  }
34
53
  catch (err) {
35
54
  const customError = await handleApiError(err);
36
- return { success: false, error: customError };
55
+ return {
56
+ success: false,
57
+ error: customError,
58
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
59
+ };
37
60
  }
38
61
  }
39
62
  /**
@@ -51,15 +74,24 @@ export class AasDiscoveryClient {
51
74
  try {
52
75
  const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
53
76
  const encodedAasIdentifier = base64Encode(aasIdentifier);
54
- const result = await apiInstance.postAllAssetLinksById({
77
+ const response = await apiInstance.postAllAssetLinksByIdRaw({
55
78
  aasIdentifier: encodedAasIdentifier,
56
79
  specificAssetId: specificAssetId.map(convertCoreAssetIdToApiAssetId),
57
80
  });
58
- return { success: true, data: result.map(convertApiAssetIdToCoreAssetId) };
81
+ const result = await response.value();
82
+ return {
83
+ success: true,
84
+ data: result.map(convertApiAssetIdToCoreAssetId),
85
+ statusCode: response.raw.status,
86
+ };
59
87
  }
60
88
  catch (err) {
61
89
  const customError = await handleApiError(err);
62
- return { success: false, error: customError };
90
+ return {
91
+ success: false,
92
+ error: customError,
93
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
94
+ };
63
95
  }
64
96
  }
65
97
  /**
@@ -76,14 +108,19 @@ export class AasDiscoveryClient {
76
108
  try {
77
109
  const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
78
110
  const encodedAasIdentifier = base64Encode(aasIdentifier);
79
- const result = await apiInstance.deleteAllAssetLinksById({
111
+ const response = await apiInstance.deleteAllAssetLinksByIdRaw({
80
112
  aasIdentifier: encodedAasIdentifier,
81
113
  });
82
- return { success: true, data: result };
114
+ const result = await response.value();
115
+ return { success: true, data: result, statusCode: response.raw.status };
83
116
  }
84
117
  catch (err) {
85
118
  const customError = await handleApiError(err);
86
- return { success: false, error: customError };
119
+ return {
120
+ success: false,
121
+ error: customError,
122
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
123
+ };
87
124
  }
88
125
  }
89
126
  /**
@@ -100,14 +137,23 @@ export class AasDiscoveryClient {
100
137
  try {
101
138
  const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
102
139
  const encodedAasIdentifier = base64Encode(aasIdentifier);
103
- const result = await apiInstance.getAllAssetLinksById({
140
+ const response = await apiInstance.getAllAssetLinksByIdRaw({
104
141
  aasIdentifier: encodedAasIdentifier,
105
142
  });
106
- return { success: true, data: result.map(convertApiAssetIdToCoreAssetId) };
143
+ const result = await response.value();
144
+ return {
145
+ success: true,
146
+ data: result.map(convertApiAssetIdToCoreAssetId),
147
+ statusCode: response.raw.status,
148
+ };
107
149
  }
108
150
  catch (err) {
109
151
  const customError = await handleApiError(err);
110
- return { success: false, error: customError };
152
+ return {
153
+ success: false,
154
+ error: customError,
155
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
156
+ };
111
157
  }
112
158
  }
113
159
  /**
@@ -117,7 +163,7 @@ export class AasDiscoveryClient {
117
163
  * - configuration: The http request options
118
164
  * - assetLink?: A list of specific Asset identifiers
119
165
  * - limit?: The maximum number of elements in the response array
120
- * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
166
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
121
167
  *
122
168
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
123
169
  */
@@ -125,20 +171,27 @@ export class AasDiscoveryClient {
125
171
  const { configuration, assetLink, limit, cursor } = options;
126
172
  try {
127
173
  const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
128
- const result = await apiInstance.searchAllAssetAdministrationShellIdsByAssetLink({
174
+ const response = await apiInstance.searchAllAssetAdministrationShellIdsByAssetLinkRaw({
129
175
  assetLink: assetLink?.map((id) => ({ name: id.name, value: id.value })),
130
176
  limit: limit,
131
177
  cursor: cursor,
132
178
  });
179
+ const result = await response.value();
133
180
  const shellIds = result.result ?? [];
181
+ const pagedResult = result.paging_metadata;
134
182
  return {
135
183
  success: true,
136
- data: { pagedResult: result.pagingMetadata, result: shellIds },
184
+ data: { pagedResult, result: shellIds },
185
+ statusCode: response.raw.status,
137
186
  };
138
187
  }
139
188
  catch (err) {
140
189
  const customError = await handleApiError(err);
141
- return { success: false, error: customError };
190
+ return {
191
+ success: false,
192
+ error: customError,
193
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
194
+ };
142
195
  }
143
196
  }
144
197
  /**
@@ -153,12 +206,17 @@ export class AasDiscoveryClient {
153
206
  const { configuration } = options;
154
207
  try {
155
208
  const apiInstance = new AasDiscoveryService.DescriptionAPIApi(applyDefaults(configuration));
156
- const result = await apiInstance.getSelfDescription();
157
- return { success: true, data: result };
209
+ const response = await apiInstance.getSelfDescriptionRaw();
210
+ const result = await response.value();
211
+ return { success: true, data: result, statusCode: response.raw.status };
158
212
  }
159
213
  catch (err) {
160
214
  const customError = await handleApiError(err);
161
- return { success: false, error: customError };
215
+ return {
216
+ success: false,
217
+ error: customError,
218
+ statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
219
+ };
162
220
  }
163
221
  }
164
222
  }
@@ -3,13 +3,15 @@ import { AasRegistryService } from '../generated';
3
3
  import { Configuration } from '../generated/runtime';
4
4
  import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
5
5
  export declare class AasRegistryClient {
6
+ private static requireIdentifier;
7
+ private static extractStatusCode;
6
8
  /**
7
9
  * Returns all Asset Administration Shell Descriptors
8
10
  *
9
11
  * @param options Object containing:
10
12
  * - configuration: The http request options
11
13
  * - 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
14
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
13
15
  * - assetKind?: The Asset's kind (Instance or Type)
14
16
  * - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
15
17
  *
@@ -86,7 +88,7 @@ export declare class AasRegistryClient {
86
88
  * - configuration: The http request options
87
89
  * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
88
90
  * - 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
91
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
90
92
  *
91
93
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
92
94
  */
@@ -1,16 +1,38 @@
1
1
  import { AasRegistryService } from '../generated';
2
+ import { RequiredError } from '../generated/runtime';
2
3
  import { applyDefaults } from '../lib/apiConfig';
3
4
  import { base64Encode } from '../lib/base64Url';
4
5
  import { convertApiAasDescriptorToCoreAasDescriptor, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreAasDescriptorToApiAasDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
5
6
  import { handleApiError } from '../lib/errorHandler';
6
7
  export class AasRegistryClient {
8
+ static requireIdentifier(value, field) {
9
+ if (value === null || value === undefined || value.trim() === '') {
10
+ throw new RequiredError(field, `Required parameter "${field}" was null, undefined, or empty.`);
11
+ }
12
+ return value;
13
+ }
14
+ static extractStatusCode(err, parsedError) {
15
+ const responseStatus = err?.response?.status;
16
+ if (typeof responseStatus === 'number') {
17
+ return responseStatus;
18
+ }
19
+ if (err instanceof RequiredError || err?.name === 'RequiredError') {
20
+ return 400;
21
+ }
22
+ const code = parsedError?.messages?.[0]?.code;
23
+ if (!code) {
24
+ return undefined;
25
+ }
26
+ const parsedCode = Number.parseInt(code, 10);
27
+ return Number.isNaN(parsedCode) ? undefined : parsedCode;
28
+ }
7
29
  /**
8
30
  * Returns all Asset Administration Shell Descriptors
9
31
  *
10
32
  * @param options Object containing:
11
33
  * - configuration: The http request options
12
34
  * - 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
35
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
14
36
  * - assetKind?: The Asset's kind (Instance or Type)
15
37
  * - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
16
38
  *
@@ -21,21 +43,28 @@ export class AasRegistryClient {
21
43
  try {
22
44
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
23
45
  const encodedAssetType = assetType ? base64Encode(assetType) : undefined;
24
- const result = await apiInstance.getAllAssetAdministrationShellDescriptors({
46
+ const response = await apiInstance.getAllAssetAdministrationShellDescriptorsRaw({
25
47
  limit: limit,
26
48
  cursor: cursor,
27
49
  assetKind: assetKind,
28
50
  assetType: encodedAssetType,
29
51
  });
52
+ const result = await response.value();
30
53
  const aasDescriptors = (result.result ?? []).map(convertApiAasDescriptorToCoreAasDescriptor);
54
+ const pagedResult = result.paging_metadata;
31
55
  return {
32
56
  success: true,
33
- data: { pagedResult: result.pagingMetadata, result: aasDescriptors },
57
+ data: { pagedResult, result: aasDescriptors },
58
+ statusCode: response.raw.status,
34
59
  };
35
60
  }
36
61
  catch (err) {
37
62
  const customError = await handleApiError(err);
38
- return { success: false, error: customError };
63
+ return {
64
+ success: false,
65
+ error: customError,
66
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
67
+ };
39
68
  }
40
69
  }
41
70
  /**
@@ -51,14 +80,23 @@ export class AasRegistryClient {
51
80
  const { configuration, assetAdministrationShellDescriptor } = options;
52
81
  try {
53
82
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
54
- const result = await apiInstance.postAssetAdministrationShellDescriptor({
83
+ const response = await apiInstance.postAssetAdministrationShellDescriptorRaw({
55
84
  assetAdministrationShellDescriptor: convertCoreAasDescriptorToApiAasDescriptor(assetAdministrationShellDescriptor),
56
85
  });
57
- return { success: true, data: convertApiAasDescriptorToCoreAasDescriptor(result) };
86
+ const result = await response.value();
87
+ return {
88
+ success: true,
89
+ data: convertApiAasDescriptorToCoreAasDescriptor(result),
90
+ statusCode: response.raw.status,
91
+ };
58
92
  }
59
93
  catch (err) {
60
94
  const customError = await handleApiError(err);
61
- return { success: false, error: customError };
95
+ return {
96
+ success: false,
97
+ error: customError,
98
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
99
+ };
62
100
  }
63
101
  }
64
102
  /**
@@ -74,15 +112,20 @@ export class AasRegistryClient {
74
112
  const { configuration, aasIdentifier } = options;
75
113
  try {
76
114
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
77
- const encodedAasIdentifier = base64Encode(aasIdentifier);
78
- const result = await apiInstance.deleteAssetAdministrationShellDescriptorById({
115
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
116
+ const response = await apiInstance.deleteAssetAdministrationShellDescriptorByIdRaw({
79
117
  aasIdentifier: encodedAasIdentifier,
80
118
  });
81
- return { success: true, data: result };
119
+ const result = await response.value();
120
+ return { success: true, data: result, statusCode: response.raw.status };
82
121
  }
83
122
  catch (err) {
84
123
  const customError = await handleApiError(err);
85
- return { success: false, error: customError };
124
+ return {
125
+ success: false,
126
+ error: customError,
127
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
128
+ };
86
129
  }
87
130
  }
88
131
  /**
@@ -98,15 +141,24 @@ export class AasRegistryClient {
98
141
  const { configuration, aasIdentifier } = options;
99
142
  try {
100
143
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
101
- const encodedAasIdentifier = base64Encode(aasIdentifier);
102
- const result = await apiInstance.getAssetAdministrationShellDescriptorById({
144
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
145
+ const response = await apiInstance.getAssetAdministrationShellDescriptorByIdRaw({
103
146
  aasIdentifier: encodedAasIdentifier,
104
147
  });
105
- return { success: true, data: convertApiAasDescriptorToCoreAasDescriptor(result) };
148
+ const result = await response.value();
149
+ return {
150
+ success: true,
151
+ data: convertApiAasDescriptorToCoreAasDescriptor(result),
152
+ statusCode: response.raw.status,
153
+ };
106
154
  }
107
155
  catch (err) {
108
156
  const customError = await handleApiError(err);
109
- return { success: false, error: customError };
157
+ return {
158
+ success: false,
159
+ error: customError,
160
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
161
+ };
110
162
  }
111
163
  }
112
164
  /**
@@ -123,16 +175,28 @@ export class AasRegistryClient {
123
175
  const { configuration, aasIdentifier, assetAdministrationShellDescriptor } = options;
124
176
  try {
125
177
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
126
- const encodedAasIdentifier = base64Encode(aasIdentifier);
127
- const result = await apiInstance.putAssetAdministrationShellDescriptorById({
178
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
179
+ const response = await apiInstance.putAssetAdministrationShellDescriptorByIdRaw({
128
180
  aasIdentifier: encodedAasIdentifier,
129
181
  assetAdministrationShellDescriptor: convertCoreAasDescriptorToApiAasDescriptor(assetAdministrationShellDescriptor),
130
182
  });
131
- return { success: true, data: result ? convertApiAasDescriptorToCoreAasDescriptor(result) : undefined };
183
+ if (response.raw.status === 204) {
184
+ return { success: true, data: undefined, statusCode: response.raw.status };
185
+ }
186
+ const result = await response.value();
187
+ return {
188
+ success: true,
189
+ data: result ? convertApiAasDescriptorToCoreAasDescriptor(result) : undefined,
190
+ statusCode: response.raw.status,
191
+ };
132
192
  }
133
193
  catch (err) {
134
194
  const customError = await handleApiError(err);
135
- return { success: false, error: customError };
195
+ return {
196
+ success: false,
197
+ error: customError,
198
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
199
+ };
136
200
  }
137
201
  }
138
202
  /**
@@ -142,7 +206,7 @@ export class AasRegistryClient {
142
206
  * - configuration: The http request options
143
207
  * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
144
208
  * - limit?: The maximum number of elements in the response array
145
- * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
209
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
146
210
  *
147
211
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
148
212
  */
@@ -150,21 +214,28 @@ export class AasRegistryClient {
150
214
  const { configuration, aasIdentifier, limit, cursor } = options;
151
215
  try {
152
216
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
153
- const encodedAasIdentifier = base64Encode(aasIdentifier);
154
- const result = await apiInstance.getAllSubmodelDescriptorsThroughSuperpath({
217
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
218
+ const response = await apiInstance.getAllSubmodelDescriptorsThroughSuperpathRaw({
155
219
  aasIdentifier: encodedAasIdentifier,
156
220
  limit: limit,
157
221
  cursor: cursor,
158
222
  });
223
+ const result = await response.value();
159
224
  const submodelDescriptors = (result.result ?? []).map(convertApiSubmodelDescriptorToCoreSubmodelDescriptor);
225
+ const pagedResult = result.paging_metadata;
160
226
  return {
161
227
  success: true,
162
- data: { pagedResult: result.pagingMetadata, result: submodelDescriptors },
228
+ data: { pagedResult, result: submodelDescriptors },
229
+ statusCode: response.raw.status,
163
230
  };
164
231
  }
165
232
  catch (err) {
166
233
  const customError = await handleApiError(err);
167
- return { success: false, error: customError };
234
+ return {
235
+ success: false,
236
+ error: customError,
237
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
238
+ };
168
239
  }
169
240
  }
170
241
  /**
@@ -181,16 +252,25 @@ export class AasRegistryClient {
181
252
  const { configuration, aasIdentifier, submodelDescriptor } = options;
182
253
  try {
183
254
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
184
- const encodedAasIdentifier = base64Encode(aasIdentifier);
185
- const result = await apiInstance.postSubmodelDescriptorThroughSuperpath({
255
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
256
+ const response = await apiInstance.postSubmodelDescriptorThroughSuperpathRaw({
186
257
  aasIdentifier: encodedAasIdentifier,
187
258
  submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
188
259
  });
189
- return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
260
+ const result = await response.value();
261
+ return {
262
+ success: true,
263
+ data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result),
264
+ statusCode: response.raw.status,
265
+ };
190
266
  }
191
267
  catch (err) {
192
268
  const customError = await handleApiError(err);
193
- return { success: false, error: customError };
269
+ return {
270
+ success: false,
271
+ error: customError,
272
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
273
+ };
194
274
  }
195
275
  }
196
276
  /**
@@ -207,17 +287,26 @@ export class AasRegistryClient {
207
287
  const { configuration, aasIdentifier, submodelIdentifier } = options;
208
288
  try {
209
289
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
210
- const encodedAasIdentifier = base64Encode(aasIdentifier);
211
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
212
- const result = await apiInstance.getSubmodelDescriptorByIdThroughSuperpath({
290
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
291
+ const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
292
+ const response = await apiInstance.getSubmodelDescriptorByIdThroughSuperpathRaw({
213
293
  aasIdentifier: encodedAasIdentifier,
214
294
  submodelIdentifier: encodedSubmodelIdentifier,
215
295
  });
216
- return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
296
+ const result = await response.value();
297
+ return {
298
+ success: true,
299
+ data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result),
300
+ statusCode: response.raw.status,
301
+ };
217
302
  }
218
303
  catch (err) {
219
304
  const customError = await handleApiError(err);
220
- return { success: false, error: customError };
305
+ return {
306
+ success: false,
307
+ error: customError,
308
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
309
+ };
221
310
  }
222
311
  }
223
312
  /**
@@ -234,17 +323,22 @@ export class AasRegistryClient {
234
323
  const { configuration, aasIdentifier, submodelIdentifier } = options;
235
324
  try {
236
325
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
237
- const encodedAasIdentifier = base64Encode(aasIdentifier);
238
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
239
- const result = await apiInstance.deleteSubmodelDescriptorByIdThroughSuperpath({
326
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
327
+ const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
328
+ const response = await apiInstance.deleteSubmodelDescriptorByIdThroughSuperpathRaw({
240
329
  aasIdentifier: encodedAasIdentifier,
241
330
  submodelIdentifier: encodedSubmodelIdentifier,
242
331
  });
243
- return { success: true, data: result };
332
+ const result = await response.value();
333
+ return { success: true, data: result, statusCode: response.raw.status };
244
334
  }
245
335
  catch (err) {
246
336
  const customError = await handleApiError(err);
247
- return { success: false, error: customError };
337
+ return {
338
+ success: false,
339
+ error: customError,
340
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
341
+ };
248
342
  }
249
343
  }
250
344
  /**
@@ -262,21 +356,30 @@ export class AasRegistryClient {
262
356
  const { configuration, aasIdentifier, submodelIdentifier, submodelDescriptor } = options;
263
357
  try {
264
358
  const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
265
- const encodedAasIdentifier = base64Encode(aasIdentifier);
266
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
267
- const result = await apiInstance.putSubmodelDescriptorByIdThroughSuperpath({
359
+ const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
360
+ const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
361
+ const response = await apiInstance.putSubmodelDescriptorByIdThroughSuperpathRaw({
268
362
  aasIdentifier: encodedAasIdentifier,
269
363
  submodelIdentifier: encodedSubmodelIdentifier,
270
364
  submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
271
365
  });
366
+ if (response.raw.status === 204) {
367
+ return { success: true, data: undefined, statusCode: response.raw.status };
368
+ }
369
+ const result = await response.value();
272
370
  return {
273
371
  success: true,
274
372
  data: result ? convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) : undefined,
373
+ statusCode: response.raw.status,
275
374
  };
276
375
  }
277
376
  catch (err) {
278
377
  const customError = await handleApiError(err);
279
- return { success: false, error: customError };
378
+ return {
379
+ success: false,
380
+ error: customError,
381
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
382
+ };
280
383
  }
281
384
  }
282
385
  /**
@@ -291,12 +394,17 @@ export class AasRegistryClient {
291
394
  const { configuration } = options;
292
395
  try {
293
396
  const apiInstance = new AasRegistryService.DescriptionAPIApi(applyDefaults(configuration));
294
- const result = await apiInstance.getSelfDescription();
295
- return { success: true, data: result };
397
+ const response = await apiInstance.getSelfDescriptionRaw();
398
+ const result = await response.value();
399
+ return { success: true, data: result, statusCode: response.raw.status };
296
400
  }
297
401
  catch (err) {
298
402
  const customError = await handleApiError(err);
299
- return { success: false, error: customError };
403
+ return {
404
+ success: false,
405
+ error: customError,
406
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
407
+ };
300
408
  }
301
409
  }
302
410
  }