basyx-typescript-sdk 0.2.1 → 0.2.2
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/bundle/index.js +58 -54
- package/bundle/index.js.map +1 -1
- package/dist/clients/AasRepositoryClient.js +58 -54
- package/package.json +1 -1
|
@@ -21,18 +21,18 @@ export class AasRepositoryClient {
|
|
|
21
21
|
try {
|
|
22
22
|
const client = createCustomClient(baseUrl, headers);
|
|
23
23
|
const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify(id)));
|
|
24
|
-
const
|
|
24
|
+
const result = await AasRepository.getAllAssetAdministrationShells({
|
|
25
25
|
client,
|
|
26
26
|
query: { assetIds: encodedAssetIds, idShort, limit, cursor },
|
|
27
27
|
});
|
|
28
|
-
if (error) {
|
|
29
|
-
return { success: false, error };
|
|
28
|
+
if (result.error) {
|
|
29
|
+
return { success: false, error: result.error };
|
|
30
30
|
}
|
|
31
|
-
const shells = (data.result ?? []).map(convertApiAasToCoreAas);
|
|
31
|
+
const shells = (result.data.result ?? []).map(convertApiAasToCoreAas);
|
|
32
32
|
return {
|
|
33
33
|
success: true,
|
|
34
34
|
data: {
|
|
35
|
-
pagedResult: data.paging_metadata,
|
|
35
|
+
pagedResult: result.data.paging_metadata,
|
|
36
36
|
result: shells,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
@@ -58,14 +58,14 @@ export class AasRepositoryClient {
|
|
|
58
58
|
const { baseUrl, assetAdministrationShell, headers } = options;
|
|
59
59
|
try {
|
|
60
60
|
const client = createCustomClient(baseUrl, headers);
|
|
61
|
-
const
|
|
61
|
+
const result = await AasRepository.postAssetAdministrationShell({
|
|
62
62
|
client,
|
|
63
63
|
body: convertCoreAasToApiAas(assetAdministrationShell),
|
|
64
64
|
});
|
|
65
|
-
if (error) {
|
|
66
|
-
return { success: false, error };
|
|
65
|
+
if (result.error) {
|
|
66
|
+
return { success: false, error: result.error };
|
|
67
67
|
}
|
|
68
|
-
return { success: true, data: convertApiAasToCoreAas(data) };
|
|
68
|
+
return { success: true, data: convertApiAasToCoreAas(result.data) };
|
|
69
69
|
}
|
|
70
70
|
catch (err) {
|
|
71
71
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -86,14 +86,14 @@ export class AasRepositoryClient {
|
|
|
86
86
|
try {
|
|
87
87
|
const client = createCustomClient(baseUrl, headers);
|
|
88
88
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
89
|
-
const
|
|
89
|
+
const result = await AasRepository.deleteAssetAdministrationShellById({
|
|
90
90
|
client,
|
|
91
91
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
92
92
|
});
|
|
93
|
-
if (error) {
|
|
94
|
-
return { success: false, error };
|
|
93
|
+
if (result.error) {
|
|
94
|
+
return { success: false, error: result.error };
|
|
95
95
|
}
|
|
96
|
-
return { success: true, data };
|
|
96
|
+
return { success: true, data: result.data };
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
|
99
99
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -114,14 +114,18 @@ export class AasRepositoryClient {
|
|
|
114
114
|
try {
|
|
115
115
|
const client = createCustomClient(baseUrl, headers);
|
|
116
116
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
117
|
-
const
|
|
117
|
+
const result = await AasRepository.getAssetAdministrationShellById({
|
|
118
118
|
client,
|
|
119
119
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
120
120
|
});
|
|
121
|
-
if (error) {
|
|
122
|
-
|
|
121
|
+
if (result.error) {
|
|
122
|
+
// Return the complete error object with status code
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
error: result.error,
|
|
126
|
+
};
|
|
123
127
|
}
|
|
124
|
-
return { success: true, data: convertApiAasToCoreAas(data) };
|
|
128
|
+
return { success: true, data: convertApiAasToCoreAas(result.data) };
|
|
125
129
|
}
|
|
126
130
|
catch (err) {
|
|
127
131
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -143,15 +147,15 @@ export class AasRepositoryClient {
|
|
|
143
147
|
try {
|
|
144
148
|
const client = createCustomClient(baseUrl, headers);
|
|
145
149
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
146
|
-
const
|
|
150
|
+
const result = await AasRepository.putAssetAdministrationShellById({
|
|
147
151
|
client,
|
|
148
152
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
149
153
|
body: convertCoreAasToApiAas(assetAdministrationShell),
|
|
150
154
|
});
|
|
151
|
-
if (error) {
|
|
152
|
-
return { success: false, error };
|
|
155
|
+
if (result.error) {
|
|
156
|
+
return { success: false, error: result.error };
|
|
153
157
|
}
|
|
154
|
-
return { success: true, data };
|
|
158
|
+
return { success: true, data: result.data };
|
|
155
159
|
}
|
|
156
160
|
catch (err) {
|
|
157
161
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -172,16 +176,16 @@ export class AasRepositoryClient {
|
|
|
172
176
|
try {
|
|
173
177
|
const client = createCustomClient(baseUrl, headers);
|
|
174
178
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
175
|
-
const
|
|
179
|
+
const result = await AasRepository.getAssetInformationAasRepository({
|
|
176
180
|
client,
|
|
177
181
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
178
182
|
});
|
|
179
|
-
if (error) {
|
|
180
|
-
return { success: false, error };
|
|
183
|
+
if (result.error) {
|
|
184
|
+
return { success: false, error: result.error };
|
|
181
185
|
}
|
|
182
186
|
return {
|
|
183
187
|
success: true,
|
|
184
|
-
data: convertApiAssetInformationToCoreAssetInformation(data),
|
|
188
|
+
data: convertApiAssetInformationToCoreAssetInformation(result.data),
|
|
185
189
|
};
|
|
186
190
|
}
|
|
187
191
|
catch (err) {
|
|
@@ -204,15 +208,15 @@ export class AasRepositoryClient {
|
|
|
204
208
|
try {
|
|
205
209
|
const client = createCustomClient(baseUrl, headers);
|
|
206
210
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
207
|
-
const
|
|
211
|
+
const result = await AasRepository.putAssetInformationAasRepository({
|
|
208
212
|
client,
|
|
209
213
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
210
214
|
body: convertCoreAssetInformationToApiAssetInformation(assetInformation),
|
|
211
215
|
});
|
|
212
|
-
if (error) {
|
|
213
|
-
return { success: false, error };
|
|
216
|
+
if (result.error) {
|
|
217
|
+
return { success: false, error: result.error };
|
|
214
218
|
}
|
|
215
|
-
return { success: true, data };
|
|
219
|
+
return { success: true, data: result.data };
|
|
216
220
|
}
|
|
217
221
|
catch (err) {
|
|
218
222
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -233,16 +237,16 @@ export class AasRepositoryClient {
|
|
|
233
237
|
try {
|
|
234
238
|
const client = createCustomClient(baseUrl, headers);
|
|
235
239
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
236
|
-
const
|
|
240
|
+
const result = await AasRepository.deleteThumbnailAasRepository({
|
|
237
241
|
client,
|
|
238
242
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
239
243
|
});
|
|
240
|
-
if (error) {
|
|
241
|
-
return { success: false, error };
|
|
244
|
+
if (result.error) {
|
|
245
|
+
return { success: false, error: result.error };
|
|
242
246
|
}
|
|
243
247
|
return {
|
|
244
248
|
success: true,
|
|
245
|
-
data: data,
|
|
249
|
+
data: result.data,
|
|
246
250
|
};
|
|
247
251
|
}
|
|
248
252
|
catch (err) {
|
|
@@ -264,14 +268,14 @@ export class AasRepositoryClient {
|
|
|
264
268
|
try {
|
|
265
269
|
const client = createCustomClient(baseUrl, headers);
|
|
266
270
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
267
|
-
const
|
|
271
|
+
const result = await AasRepository.getThumbnailAasRepository({
|
|
268
272
|
client,
|
|
269
273
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
270
274
|
});
|
|
271
|
-
if (error) {
|
|
272
|
-
return { success: false, error };
|
|
275
|
+
if (result.error) {
|
|
276
|
+
return { success: false, error: result.error };
|
|
273
277
|
}
|
|
274
|
-
return { success: true, data };
|
|
278
|
+
return { success: true, data: result.data };
|
|
275
279
|
}
|
|
276
280
|
catch (err) {
|
|
277
281
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -293,15 +297,15 @@ export class AasRepositoryClient {
|
|
|
293
297
|
try {
|
|
294
298
|
const client = createCustomClient(baseUrl, headers);
|
|
295
299
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
296
|
-
const
|
|
300
|
+
const result = await AasRepository.putThumbnailAasRepository({
|
|
297
301
|
client,
|
|
298
302
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
299
303
|
body: thumbnail,
|
|
300
304
|
});
|
|
301
|
-
if (error) {
|
|
302
|
-
return { success: false, error };
|
|
305
|
+
if (result.error) {
|
|
306
|
+
return { success: false, error: result.error };
|
|
303
307
|
}
|
|
304
|
-
return { success: true, data };
|
|
308
|
+
return { success: true, data: result.data };
|
|
305
309
|
}
|
|
306
310
|
catch (err) {
|
|
307
311
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -324,19 +328,19 @@ export class AasRepositoryClient {
|
|
|
324
328
|
try {
|
|
325
329
|
const client = createCustomClient(baseUrl, headers);
|
|
326
330
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
327
|
-
const
|
|
331
|
+
const result = await AasRepository.getAllSubmodelReferencesAasRepository({
|
|
328
332
|
client,
|
|
329
333
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
330
334
|
query: { limit, cursor },
|
|
331
335
|
});
|
|
332
|
-
if (error) {
|
|
333
|
-
return { success: false, error };
|
|
336
|
+
if (result.error) {
|
|
337
|
+
return { success: false, error: result.error };
|
|
334
338
|
}
|
|
335
|
-
const submodelReferences = (data.result ?? []).map(convertApiReferenceToCoreReference);
|
|
339
|
+
const submodelReferences = (result.data.result ?? []).map(convertApiReferenceToCoreReference);
|
|
336
340
|
return {
|
|
337
341
|
success: true,
|
|
338
342
|
data: {
|
|
339
|
-
pagedResult: data.paging_metadata,
|
|
343
|
+
pagedResult: result.data.paging_metadata,
|
|
340
344
|
result: submodelReferences,
|
|
341
345
|
},
|
|
342
346
|
};
|
|
@@ -361,15 +365,15 @@ export class AasRepositoryClient {
|
|
|
361
365
|
try {
|
|
362
366
|
const client = createCustomClient(baseUrl, headers);
|
|
363
367
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
364
|
-
const
|
|
368
|
+
const result = await AasRepository.postSubmodelReferenceAasRepository({
|
|
365
369
|
client,
|
|
366
370
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
367
371
|
body: convertCoreReferenceToApiReference(submodelReference),
|
|
368
372
|
});
|
|
369
|
-
if (error) {
|
|
370
|
-
return { success: false, error };
|
|
373
|
+
if (result.error) {
|
|
374
|
+
return { success: false, error: result.error };
|
|
371
375
|
}
|
|
372
|
-
return { success: true, data: convertApiReferenceToCoreReference(data) };
|
|
376
|
+
return { success: true, data: convertApiReferenceToCoreReference(result.data) };
|
|
373
377
|
}
|
|
374
378
|
catch (err) {
|
|
375
379
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -392,17 +396,17 @@ export class AasRepositoryClient {
|
|
|
392
396
|
const client = createCustomClient(baseUrl, headers);
|
|
393
397
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
394
398
|
const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
|
|
395
|
-
const
|
|
399
|
+
const result = await AasRepository.deleteSubmodelReferenceByIdAasRepository({
|
|
396
400
|
client,
|
|
397
401
|
path: {
|
|
398
402
|
aasIdentifier: encodedAasIdentifier,
|
|
399
403
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
400
404
|
},
|
|
401
405
|
});
|
|
402
|
-
if (error) {
|
|
403
|
-
return { success: false, error };
|
|
406
|
+
if (result.error) {
|
|
407
|
+
return { success: false, error: result.error };
|
|
404
408
|
}
|
|
405
|
-
return { success: true, data };
|
|
409
|
+
return { success: true, data: result.data };
|
|
406
410
|
}
|
|
407
411
|
catch (err) {
|
|
408
412
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
package/package.json
CHANGED