basyx-typescript-sdk 2.2.5 → 2.3.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.
- package/README.md +54 -0
- package/bundle/index.cjs +1181 -511
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +1181 -511
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasDiscoveryClient.d.ts +9 -3
- package/dist/clients/AasDiscoveryClient.js +28 -9
- package/dist/clients/AasRegistryClient.d.ts +28 -8
- package/dist/clients/AasRegistryClient.js +63 -21
- package/dist/clients/AasRepositoryClient.d.ts +170 -56
- package/dist/clients/AasRepositoryClient.js +385 -136
- package/dist/clients/AasxFileClient.d.ts +11 -3
- package/dist/clients/AasxFileClient.js +27 -11
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +11 -3
- package/dist/clients/ConceptDescriptionRepositoryClient.js +40 -12
- package/dist/clients/SubmodelRegistryClient.d.ts +11 -3
- package/dist/clients/SubmodelRegistryClient.js +28 -8
- package/dist/clients/SubmodelRepositoryClient.d.ts +108 -34
- package/dist/clients/SubmodelRepositoryClient.js +262 -106
- package/dist/lib/apiConfig.d.ts +2 -1
- package/dist/lib/apiConfig.js +27 -2
- package/dist/lib/conditionalRequests.d.ts +28 -0
- package/dist/lib/conditionalRequests.js +55 -0
- package/dist/models/api.d.ts +38 -2
- package/dist/services/AasService.d.ts +13 -3
- package/dist/services/AasService.js +45 -7
- package/dist/services/SubmodelService.d.ts +13 -3
- package/dist/services/SubmodelService.js +49 -7
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { AasRegistryService } from '../generated';
|
|
|
2
2
|
import { RequiredError } from '../generated/runtime';
|
|
3
3
|
import { applyDefaults } from '../lib/apiConfig';
|
|
4
4
|
import { base64Encode } from '../lib/base64Url';
|
|
5
|
+
import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
|
|
5
6
|
import { convertApiAasDescriptorToCoreAasDescriptor, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreAasDescriptorToApiAasDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
|
|
6
7
|
import { handleApiError } from '../lib/errorHandler';
|
|
7
8
|
export class AasRegistryClient {
|
|
@@ -56,6 +57,7 @@ export class AasRegistryClient {
|
|
|
56
57
|
success: true,
|
|
57
58
|
data: { pagedResult, result: aasDescriptors },
|
|
58
59
|
statusCode: response.raw.status,
|
|
60
|
+
etag: getEtag(response.raw),
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
catch (err) {
|
|
@@ -64,6 +66,7 @@ export class AasRegistryClient {
|
|
|
64
66
|
success: false,
|
|
65
67
|
error: customError,
|
|
66
68
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
69
|
+
...getConditionalErrorFields(err),
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -88,6 +91,7 @@ export class AasRegistryClient {
|
|
|
88
91
|
success: true,
|
|
89
92
|
data: convertApiAasDescriptorToCoreAasDescriptor(result),
|
|
90
93
|
statusCode: response.raw.status,
|
|
94
|
+
etag: getEtag(response.raw),
|
|
91
95
|
};
|
|
92
96
|
}
|
|
93
97
|
catch (err) {
|
|
@@ -96,6 +100,7 @@ export class AasRegistryClient {
|
|
|
96
100
|
success: false,
|
|
97
101
|
error: customError,
|
|
98
102
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
103
|
+
...getConditionalErrorFields(err),
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
106
|
}
|
|
@@ -105,19 +110,20 @@ export class AasRegistryClient {
|
|
|
105
110
|
* @param options Object containing:
|
|
106
111
|
* - configuration: The http request options
|
|
107
112
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
113
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
108
114
|
*
|
|
109
115
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
110
116
|
*/
|
|
111
117
|
async deleteAssetAdministrationShellDescriptorById(options) {
|
|
112
|
-
const { configuration, aasIdentifier } = options;
|
|
118
|
+
const { configuration, aasIdentifier, ifMatch } = options;
|
|
113
119
|
try {
|
|
114
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
120
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
115
121
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
116
122
|
const response = await apiInstance.deleteAssetAdministrationShellDescriptorByIdRaw({
|
|
117
123
|
aasIdentifier: encodedAasIdentifier,
|
|
118
124
|
});
|
|
119
125
|
const result = await response.value();
|
|
120
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
126
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
121
127
|
}
|
|
122
128
|
catch (err) {
|
|
123
129
|
const customError = await handleApiError(err);
|
|
@@ -125,6 +131,7 @@ export class AasRegistryClient {
|
|
|
125
131
|
success: false,
|
|
126
132
|
error: customError,
|
|
127
133
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
134
|
+
...getConditionalErrorFields(err),
|
|
128
135
|
};
|
|
129
136
|
}
|
|
130
137
|
}
|
|
@@ -134,13 +141,14 @@ export class AasRegistryClient {
|
|
|
134
141
|
* @param options Object containing:
|
|
135
142
|
* - configuration: The http request options
|
|
136
143
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
144
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
137
145
|
*
|
|
138
146
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
139
147
|
*/
|
|
140
148
|
async getAssetAdministrationShellDescriptorById(options) {
|
|
141
|
-
const { configuration, aasIdentifier } = options;
|
|
149
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
142
150
|
try {
|
|
143
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
151
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
144
152
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
145
153
|
const response = await apiInstance.getAssetAdministrationShellDescriptorByIdRaw({
|
|
146
154
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -150,14 +158,20 @@ export class AasRegistryClient {
|
|
|
150
158
|
success: true,
|
|
151
159
|
data: convertApiAasDescriptorToCoreAasDescriptor(result),
|
|
152
160
|
statusCode: response.raw.status,
|
|
161
|
+
etag: getEtag(response.raw),
|
|
153
162
|
};
|
|
154
163
|
}
|
|
155
164
|
catch (err) {
|
|
165
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
166
|
+
if (notModified) {
|
|
167
|
+
return notModified;
|
|
168
|
+
}
|
|
156
169
|
const customError = await handleApiError(err);
|
|
157
170
|
return {
|
|
158
171
|
success: false,
|
|
159
172
|
error: customError,
|
|
160
173
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
174
|
+
...getConditionalErrorFields(err),
|
|
161
175
|
};
|
|
162
176
|
}
|
|
163
177
|
}
|
|
@@ -168,26 +182,29 @@ export class AasRegistryClient {
|
|
|
168
182
|
* - configuration: The http request options
|
|
169
183
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
170
184
|
* - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
|
|
185
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
186
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
171
187
|
*
|
|
172
188
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
173
189
|
*/
|
|
174
190
|
async putAssetAdministrationShellDescriptorById(options) {
|
|
175
|
-
const { configuration, aasIdentifier, assetAdministrationShellDescriptor } = options;
|
|
191
|
+
const { configuration, aasIdentifier, assetAdministrationShellDescriptor, ifMatch, ifNoneMatch } = options;
|
|
176
192
|
try {
|
|
177
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
193
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
178
194
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
179
195
|
const response = await apiInstance.putAssetAdministrationShellDescriptorByIdRaw({
|
|
180
196
|
aasIdentifier: encodedAasIdentifier,
|
|
181
197
|
assetAdministrationShellDescriptor: convertCoreAasDescriptorToApiAasDescriptor(assetAdministrationShellDescriptor),
|
|
182
198
|
});
|
|
183
199
|
if (response.raw.status === 204) {
|
|
184
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
200
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
185
201
|
}
|
|
186
202
|
const result = await response.value();
|
|
187
203
|
return {
|
|
188
204
|
success: true,
|
|
189
205
|
data: result ? convertApiAasDescriptorToCoreAasDescriptor(result) : undefined,
|
|
190
206
|
statusCode: response.raw.status,
|
|
207
|
+
etag: getEtag(response.raw),
|
|
191
208
|
};
|
|
192
209
|
}
|
|
193
210
|
catch (err) {
|
|
@@ -196,6 +213,7 @@ export class AasRegistryClient {
|
|
|
196
213
|
success: false,
|
|
197
214
|
error: customError,
|
|
198
215
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
216
|
+
...getConditionalErrorFields(err),
|
|
199
217
|
};
|
|
200
218
|
}
|
|
201
219
|
}
|
|
@@ -207,13 +225,14 @@ export class AasRegistryClient {
|
|
|
207
225
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
208
226
|
* - limit?: The maximum number of elements in the response array
|
|
209
227
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
228
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
210
229
|
*
|
|
211
230
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
212
231
|
*/
|
|
213
232
|
async getAllSubmodelDescriptorsThroughSuperpath(options) {
|
|
214
|
-
const { configuration, aasIdentifier, limit, cursor } = options;
|
|
233
|
+
const { configuration, aasIdentifier, limit, cursor, ifNoneMatch } = options;
|
|
215
234
|
try {
|
|
216
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
235
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
217
236
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
218
237
|
const response = await apiInstance.getAllSubmodelDescriptorsThroughSuperpathRaw({
|
|
219
238
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -227,14 +246,20 @@ export class AasRegistryClient {
|
|
|
227
246
|
success: true,
|
|
228
247
|
data: { pagedResult, result: submodelDescriptors },
|
|
229
248
|
statusCode: response.raw.status,
|
|
249
|
+
etag: getEtag(response.raw),
|
|
230
250
|
};
|
|
231
251
|
}
|
|
232
252
|
catch (err) {
|
|
253
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
254
|
+
if (notModified) {
|
|
255
|
+
return notModified;
|
|
256
|
+
}
|
|
233
257
|
const customError = await handleApiError(err);
|
|
234
258
|
return {
|
|
235
259
|
success: false,
|
|
236
260
|
error: customError,
|
|
237
261
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
262
|
+
...getConditionalErrorFields(err),
|
|
238
263
|
};
|
|
239
264
|
}
|
|
240
265
|
}
|
|
@@ -245,13 +270,14 @@ export class AasRegistryClient {
|
|
|
245
270
|
* - configuration: The http request options.
|
|
246
271
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
247
272
|
* - submodelDescriptor: Submodel Descriptor object
|
|
273
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
248
274
|
*
|
|
249
275
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
250
276
|
*/
|
|
251
277
|
async postSubmodelDescriptorThroughSuperpath(options) {
|
|
252
|
-
const { configuration, aasIdentifier, submodelDescriptor } = options;
|
|
278
|
+
const { configuration, aasIdentifier, submodelDescriptor, ifMatch } = options;
|
|
253
279
|
try {
|
|
254
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
280
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
255
281
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
256
282
|
const response = await apiInstance.postSubmodelDescriptorThroughSuperpathRaw({
|
|
257
283
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -262,6 +288,7 @@ export class AasRegistryClient {
|
|
|
262
288
|
success: true,
|
|
263
289
|
data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result),
|
|
264
290
|
statusCode: response.raw.status,
|
|
291
|
+
etag: getEtag(response.raw),
|
|
265
292
|
};
|
|
266
293
|
}
|
|
267
294
|
catch (err) {
|
|
@@ -270,6 +297,7 @@ export class AasRegistryClient {
|
|
|
270
297
|
success: false,
|
|
271
298
|
error: customError,
|
|
272
299
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
300
|
+
...getConditionalErrorFields(err),
|
|
273
301
|
};
|
|
274
302
|
}
|
|
275
303
|
}
|
|
@@ -280,13 +308,14 @@ export class AasRegistryClient {
|
|
|
280
308
|
* - configuration: The http request options
|
|
281
309
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
282
310
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
311
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
283
312
|
*
|
|
284
313
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
285
314
|
*/
|
|
286
315
|
async getSubmodelDescriptorByIdThroughSuperpath(options) {
|
|
287
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
316
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifNoneMatch } = options;
|
|
288
317
|
try {
|
|
289
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
318
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
290
319
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
291
320
|
const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
292
321
|
const response = await apiInstance.getSubmodelDescriptorByIdThroughSuperpathRaw({
|
|
@@ -298,14 +327,20 @@ export class AasRegistryClient {
|
|
|
298
327
|
success: true,
|
|
299
328
|
data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result),
|
|
300
329
|
statusCode: response.raw.status,
|
|
330
|
+
etag: getEtag(response.raw),
|
|
301
331
|
};
|
|
302
332
|
}
|
|
303
333
|
catch (err) {
|
|
334
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
335
|
+
if (notModified) {
|
|
336
|
+
return notModified;
|
|
337
|
+
}
|
|
304
338
|
const customError = await handleApiError(err);
|
|
305
339
|
return {
|
|
306
340
|
success: false,
|
|
307
341
|
error: customError,
|
|
308
342
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
343
|
+
...getConditionalErrorFields(err),
|
|
309
344
|
};
|
|
310
345
|
}
|
|
311
346
|
}
|
|
@@ -316,13 +351,14 @@ export class AasRegistryClient {
|
|
|
316
351
|
* - configuration: The http request options
|
|
317
352
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
318
353
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
354
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
319
355
|
*
|
|
320
356
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
321
357
|
*/
|
|
322
358
|
async deleteSubmodelDescriptorByIdThroughSuperpath(options) {
|
|
323
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
359
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifMatch } = options;
|
|
324
360
|
try {
|
|
325
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
361
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
326
362
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
327
363
|
const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
328
364
|
const response = await apiInstance.deleteSubmodelDescriptorByIdThroughSuperpathRaw({
|
|
@@ -330,7 +366,7 @@ export class AasRegistryClient {
|
|
|
330
366
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
331
367
|
});
|
|
332
368
|
const result = await response.value();
|
|
333
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
369
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
334
370
|
}
|
|
335
371
|
catch (err) {
|
|
336
372
|
const customError = await handleApiError(err);
|
|
@@ -338,6 +374,7 @@ export class AasRegistryClient {
|
|
|
338
374
|
success: false,
|
|
339
375
|
error: customError,
|
|
340
376
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
377
|
+
...getConditionalErrorFields(err),
|
|
341
378
|
};
|
|
342
379
|
}
|
|
343
380
|
}
|
|
@@ -349,13 +386,15 @@ export class AasRegistryClient {
|
|
|
349
386
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
350
387
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
351
388
|
* - submodelDescriptor: Submodel Descriptor object
|
|
389
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
390
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
352
391
|
*
|
|
353
392
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
354
393
|
*/
|
|
355
394
|
async putSubmodelDescriptorByIdThroughSuperpath(options) {
|
|
356
|
-
const { configuration, aasIdentifier, submodelIdentifier, submodelDescriptor } = options;
|
|
395
|
+
const { configuration, aasIdentifier, submodelIdentifier, submodelDescriptor, ifMatch, ifNoneMatch } = options;
|
|
357
396
|
try {
|
|
358
|
-
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
|
|
397
|
+
const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
359
398
|
const encodedAasIdentifier = base64Encode(AasRegistryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
360
399
|
const encodedSubmodelIdentifier = base64Encode(AasRegistryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
361
400
|
const response = await apiInstance.putSubmodelDescriptorByIdThroughSuperpathRaw({
|
|
@@ -364,13 +403,14 @@ export class AasRegistryClient {
|
|
|
364
403
|
submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
|
|
365
404
|
});
|
|
366
405
|
if (response.raw.status === 204) {
|
|
367
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
406
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
368
407
|
}
|
|
369
408
|
const result = await response.value();
|
|
370
409
|
return {
|
|
371
410
|
success: true,
|
|
372
411
|
data: result ? convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) : undefined,
|
|
373
412
|
statusCode: response.raw.status,
|
|
413
|
+
etag: getEtag(response.raw),
|
|
374
414
|
};
|
|
375
415
|
}
|
|
376
416
|
catch (err) {
|
|
@@ -379,6 +419,7 @@ export class AasRegistryClient {
|
|
|
379
419
|
success: false,
|
|
380
420
|
error: customError,
|
|
381
421
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
422
|
+
...getConditionalErrorFields(err),
|
|
382
423
|
};
|
|
383
424
|
}
|
|
384
425
|
}
|
|
@@ -396,7 +437,7 @@ export class AasRegistryClient {
|
|
|
396
437
|
const apiInstance = new AasRegistryService.DescriptionAPIApi(applyDefaults(configuration));
|
|
397
438
|
const response = await apiInstance.getSelfDescriptionRaw();
|
|
398
439
|
const result = await response.value();
|
|
399
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
440
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
400
441
|
}
|
|
401
442
|
catch (err) {
|
|
402
443
|
const customError = await handleApiError(err);
|
|
@@ -404,6 +445,7 @@ export class AasRegistryClient {
|
|
|
404
445
|
success: false,
|
|
405
446
|
error: customError,
|
|
406
447
|
statusCode: AasRegistryClient.extractStatusCode(err, customError),
|
|
448
|
+
...getConditionalErrorFields(err),
|
|
407
449
|
};
|
|
408
450
|
}
|
|
409
451
|
}
|