basyx-typescript-sdk 0.1.1 → 0.1.3

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/package.json CHANGED
@@ -1,19 +1,27 @@
1
1
  {
2
2
  "name": "basyx-typescript-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)",
5
- "main": "dist/index.js",
5
+ "main": "bundle/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./bundle/index.js",
9
+ "types": "./dist/index.d.ts"
10
+ }
11
+ },
6
12
  "repository": "https://github.com/eclipse-basyx/basyx-typescript-sdk.git",
7
13
  "author": "Aaron Zielstorff <aaron.zielstorff@iese.fraunhofer.de>",
8
14
  "license": "MIT",
9
15
  "files": [
10
- "dist",
16
+ "bundle",
17
+ "dist/index.d.ts",
11
18
  "README.md",
12
19
  "LICENSE"
13
20
  ],
14
21
  "scripts": {
15
- "gen:aasrepository": "openapi-ts -c @hey-api/client-fetch -i ./openapi/Plattform_i40-AssetAdministrationShellRepositoryServiceSpecification-V3.0.3_SSP-001-resolved.json -o ./src/generated/aas-repository",
22
+ "openapi-ts": "openapi-ts",
16
23
  "build": "tsc",
24
+ "bundle": "rollup -c",
17
25
  "lint:check": "eslint ./",
18
26
  "lint:fix": "eslint --fix ./",
19
27
  "test": "jest --coverage",
@@ -24,7 +32,9 @@
24
32
  "@hey-api/client-fetch": "^0.7.0"
25
33
  },
26
34
  "devDependencies": {
27
- "@hey-api/openapi-ts": "^0.62.3",
35
+ "@hey-api/openapi-ts": "^0.64.1",
36
+ "@rollup/plugin-commonjs": "^28.0.2",
37
+ "@rollup/plugin-node-resolve": "^16.0.0",
28
38
  "@types/jest": "^29.5.14",
29
39
  "@types/node": "^22.10.7",
30
40
  "@typescript-eslint/eslint-plugin": "^8.21.0",
@@ -37,6 +47,7 @@
37
47
  "jiti": "^2.4.2",
38
48
  "openapi-typescript-codegen": "^0.29.0",
39
49
  "prettier": "^3.4.2",
50
+ "rollup": "^4.34.6",
40
51
  "ts-jest": "^29.2.5",
41
52
  "ts-node": "^10.9.2",
42
53
  "tsconfig-paths": "^4.2.0",
@@ -1,158 +0,0 @@
1
- import type { AssetAdministrationShell, AssetInformation, Reference } from '@aas-core-works/aas-core3.0-typescript/types';
2
- import { AssetinformationThumbnailBody } from '../generated/aas-repository/types.gen';
3
- import { GetAllAssetAdministrationShellsResponse, getAllSubmodelReferencesResponse } from '../models/aas-repository';
4
- export declare class AasRepositoryClient {
5
- /**
6
- * Returns all Asset Administration Shells
7
- *
8
- * @async
9
- * @function getAllAssetAdministrationShells
10
- * @param baseURL The API base URL
11
- * @param headers Request headers
12
- * @param assetIds A list of specific Asset identifiers. Every single value asset identifier is a base64-url-encoded
13
- * @param idShort The Asset Administration Shell’s IdShort
14
- * @param limit The maximum number of elements in the response array
15
- * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
16
- * @returns {Promise<GetAllAssetAdministrationShellsResponse>} Requested Asset Administration Shells
17
- */
18
- getAllAssetAdministrationShells(baseURL: string, headers?: Headers, assetIds?: string[], idShort?: string, limit?: number, cursor?: string): Promise<GetAllAssetAdministrationShellsResponse>;
19
- /**
20
- * Creates a new Asset Administration Shell
21
- *
22
- * @async
23
- * @function postAssetAdministrationShell
24
- * @param baseURL The API base URL
25
- * @param assetAdministrationShell Asset Administration Shell object
26
- * @param headers Request headers
27
- * @returns {Promise<AssetAdministrationShell>} Asset Administration Shell created successfully
28
- */
29
- postAssetAdministrationShell(baseURL: string, assetAdministrationShell: AssetAdministrationShell, headers?: Headers): Promise<AssetAdministrationShell>;
30
- /**
31
- * Deletes an Asset Administration Shell
32
- *
33
- * @async
34
- * @function deleteAssetAdministrationShellById
35
- * @param baseURL The API base URL
36
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
37
- * @param headers Request headers
38
- * @returns {Promise<void>} Asset Administration Shell deleted successfully
39
- */
40
- deleteAssetAdministrationShellById(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<void>;
41
- /**
42
- * Returns a specific Asset Administration Shell
43
- *
44
- * @async
45
- * @function getAssetAdministrationShellById
46
- * @param baseURL The API base URL
47
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
48
- * @param headers Request headers
49
- * @returns {Promise<AssetAdministrationShell>} Requested Asset Administration Shell
50
- */
51
- getAssetAdministrationShellById(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<AssetAdministrationShell>;
52
- /**
53
- * Updates an existing Asset Administration Shell
54
- *
55
- * @async
56
- * @function putAssetAdministrationShellById
57
- * @param baseURL The API base URL
58
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
59
- * @param assetAdministrationShell Asset Administration Shell object
60
- * @param headers Request headers
61
- * @returns {Promise<void>} Asset Administration Shell updated successfully
62
- */
63
- putAssetAdministrationShellById(baseURL: string, aasIdentifier: string, assetAdministrationShell: AssetAdministrationShell, headers?: Headers): Promise<void>;
64
- /**
65
- * Returns the Asset Information
66
- *
67
- * @async
68
- * @function getAssetInformation
69
- * @param baseURL The API base URL
70
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
71
- * @param headers Request headers
72
- * @returns {Promise<AssetInformation>} Requested Asset Information
73
- */
74
- getAssetInformation(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<AssetInformation>;
75
- /**
76
- * Updates the Asset Information
77
- *
78
- * @async
79
- * @function putAssetInformation
80
- * @param baseURL The API base URL
81
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
82
- * @param assetInformation Asset Information object
83
- * @param headers Request headers
84
- * @returns {Promise<void>} Asset Information updated successfully
85
- */
86
- putAssetInformation(baseURL: string, aasIdentifier: string, assetInformation: AssetInformation, headers?: Headers): Promise<void>;
87
- /**
88
- * Deletes the Thumbnail
89
- *
90
- * @async
91
- * @function deleteThumbnail
92
- * @param baseURL The API base URL
93
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
94
- * @param headers Request headers
95
- * @returns {Promise<void>} Thumbnail deletion successful
96
- */
97
- deleteThumbnail(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<void>;
98
- /**
99
- * Returns the Thumbnail
100
- *
101
- * @async
102
- * @function getThumbnail
103
- * @param baseURL The API base URL
104
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
105
- * @param headers Request headers
106
- * @returns {Promise<Blob | File>} The thumbnail of the Asset Information.
107
- */
108
- getThumbnail(baseURL: string, aasIdentifier: string, headers?: Headers): Promise<Blob | File>;
109
- /**
110
- * Updates the Thumbnail
111
- *
112
- * @async
113
- * @function putThumbnail
114
- * @param baseURL The API base URL
115
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
116
- * @param thumbnail Thumbnail to upload
117
- * @param headers Request headers
118
- * @returns {Promise<void>} Thumbnail updated successfully
119
- */
120
- putThumbnail(baseURL: string, aasIdentifier: string, thumbnail: AssetinformationThumbnailBody, headers?: Headers): Promise<void>;
121
- /**
122
- * Returns all submodel references
123
- *
124
- * @async
125
- * @function getAllSubmodelReferences
126
- * @param baseURL The API base URL
127
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
128
- * @param headers Request headers
129
- * @param limit The maximum number of elements in the response array
130
- * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
131
- * @returns {Promise<getAllSubmodelReferencesResponse>} Requested submodel references
132
- */
133
- getAllSubmodelReferences(baseURL: string, aasIdentifier: string, headers?: Headers, limit?: number, cursor?: string): Promise<getAllSubmodelReferencesResponse>;
134
- /**
135
- * Creates a submodel reference at the Asset Administration Shell
136
- *
137
- * @async
138
- * @function postSubmodelReference
139
- * @param baseURL The API base URL
140
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
141
- * @param submodelReference Reference to the Submodel
142
- * @param headers Request headers
143
- * @returns {promise<Reference>} Submodel reference created successfully
144
- */
145
- postSubmodelReference(baseURL: string, aasIdentifier: string, submodelReference: Reference, headers?: Headers): Promise<Reference>;
146
- /**
147
- * Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
148
- *
149
- * @async
150
- * @function deleteSubmodelReferenceById
151
- * @param baseURL The API base URL
152
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
153
- * @param submodelIdentifier The Submodel’s unique id (UTF8-BASE64-URL-encoded)
154
- * @param headers Request headers
155
- * @returns {Promise<void>} Submodel reference deleted successfully
156
- */
157
- deleteSubmodelReferenceById(baseURL: string, aasIdentifier: string, submodelIdentifier: string, headers?: Headers): Promise<void>;
158
- }
@@ -1,474 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.AasRepositoryClient = void 0;
46
- const AasRepository = __importStar(require("../generated/aas-repository"));
47
- const convertAasTypes_1 = require("../lib/convertAasTypes");
48
- const createAasRepoClient_1 = require("../lib/createAasRepoClient");
49
- class AasRepositoryClient {
50
- /**
51
- * Returns all Asset Administration Shells
52
- *
53
- * @async
54
- * @function getAllAssetAdministrationShells
55
- * @param baseURL The API base URL
56
- * @param headers Request headers
57
- * @param assetIds A list of specific Asset identifiers. Every single value asset identifier is a base64-url-encoded
58
- * @param idShort The Asset Administration Shell’s IdShort
59
- * @param limit The maximum number of elements in the response array
60
- * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
61
- * @returns {Promise<GetAllAssetAdministrationShellsResponse>} Requested Asset Administration Shells
62
- */
63
- getAllAssetAdministrationShells(baseURL, headers, assetIds, idShort, limit, cursor) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- var _a;
66
- try {
67
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
68
- const { data, error } = yield AasRepository.getAllAssetAdministrationShells({
69
- client,
70
- query: {
71
- assetIds,
72
- idShort,
73
- limit,
74
- cursor,
75
- },
76
- });
77
- if (error) {
78
- console.error('Error from server:', error);
79
- throw new Error(JSON.stringify(error.messages));
80
- }
81
- const shells = ((_a = data.result) !== null && _a !== void 0 ? _a : []).map(convertAasTypes_1.convertApiAasToCoreAas);
82
- return {
83
- pagedResult: data.paging_metadata,
84
- result: shells,
85
- };
86
- }
87
- catch (error) {
88
- console.error('Error fetching Asset Administration Shells:', error);
89
- throw error;
90
- }
91
- });
92
- }
93
- /**
94
- * Creates a new Asset Administration Shell
95
- *
96
- * @async
97
- * @function postAssetAdministrationShell
98
- * @param baseURL The API base URL
99
- * @param assetAdministrationShell Asset Administration Shell object
100
- * @param headers Request headers
101
- * @returns {Promise<AssetAdministrationShell>} Asset Administration Shell created successfully
102
- */
103
- postAssetAdministrationShell(baseURL, assetAdministrationShell, headers) {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- try {
106
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
107
- const { data, error } = yield AasRepository.postAssetAdministrationShell({
108
- client,
109
- body: (0, convertAasTypes_1.convertCoreAasToApiAas)(assetAdministrationShell),
110
- });
111
- if (error) {
112
- console.error('Error from server:', error);
113
- throw new Error(JSON.stringify(error.messages));
114
- }
115
- return (0, convertAasTypes_1.convertApiAasToCoreAas)(data);
116
- }
117
- catch (error) {
118
- console.error('Error creating Asset Administration Shell:', error);
119
- throw error;
120
- }
121
- });
122
- }
123
- /**
124
- * Deletes an Asset Administration Shell
125
- *
126
- * @async
127
- * @function deleteAssetAdministrationShellById
128
- * @param baseURL The API base URL
129
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
130
- * @param headers Request headers
131
- * @returns {Promise<void>} Asset Administration Shell deleted successfully
132
- */
133
- deleteAssetAdministrationShellById(baseURL, aasIdentifier, headers) {
134
- return __awaiter(this, void 0, void 0, function* () {
135
- try {
136
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
137
- const { error } = yield AasRepository.deleteAssetAdministrationShellById({
138
- client,
139
- path: { aasIdentifier },
140
- });
141
- if (error) {
142
- console.error('Error from server:', error);
143
- throw new Error(JSON.stringify(error.messages));
144
- }
145
- return;
146
- }
147
- catch (error) {
148
- console.error('Error deleting Asset Administration Shell:', error);
149
- throw error;
150
- }
151
- });
152
- }
153
- /**
154
- * Returns a specific Asset Administration Shell
155
- *
156
- * @async
157
- * @function getAssetAdministrationShellById
158
- * @param baseURL The API base URL
159
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
160
- * @param headers Request headers
161
- * @returns {Promise<AssetAdministrationShell>} Requested Asset Administration Shell
162
- */
163
- getAssetAdministrationShellById(baseURL, aasIdentifier, headers) {
164
- return __awaiter(this, void 0, void 0, function* () {
165
- try {
166
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
167
- const { data, error } = yield AasRepository.getAssetAdministrationShellById({
168
- client,
169
- path: { aasIdentifier },
170
- });
171
- if (error) {
172
- console.error('Error from server:', error);
173
- throw new Error(JSON.stringify(error.messages));
174
- }
175
- return (0, convertAasTypes_1.convertApiAasToCoreAas)(data);
176
- }
177
- catch (error) {
178
- console.error('Error fetching Asset Administration Shell:', error);
179
- throw error;
180
- }
181
- });
182
- }
183
- /**
184
- * Updates an existing Asset Administration Shell
185
- *
186
- * @async
187
- * @function putAssetAdministrationShellById
188
- * @param baseURL The API base URL
189
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
190
- * @param assetAdministrationShell Asset Administration Shell object
191
- * @param headers Request headers
192
- * @returns {Promise<void>} Asset Administration Shell updated successfully
193
- */
194
- putAssetAdministrationShellById(baseURL, aasIdentifier, assetAdministrationShell, headers) {
195
- return __awaiter(this, void 0, void 0, function* () {
196
- try {
197
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
198
- const { error } = yield AasRepository.putAssetAdministrationShellById({
199
- client,
200
- path: { aasIdentifier },
201
- body: (0, convertAasTypes_1.convertCoreAasToApiAas)(assetAdministrationShell),
202
- });
203
- if (error) {
204
- console.error('Error from server:', error);
205
- throw new Error(JSON.stringify(error.messages));
206
- }
207
- return;
208
- }
209
- catch (error) {
210
- console.error('Error updating Asset Administration Shell:', error);
211
- throw error;
212
- }
213
- });
214
- }
215
- /**
216
- * Returns the Asset Information
217
- *
218
- * @async
219
- * @function getAssetInformation
220
- * @param baseURL The API base URL
221
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
222
- * @param headers Request headers
223
- * @returns {Promise<AssetInformation>} Requested Asset Information
224
- */
225
- getAssetInformation(baseURL, aasIdentifier, headers) {
226
- return __awaiter(this, void 0, void 0, function* () {
227
- try {
228
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
229
- const { data, error } = yield AasRepository.getAssetInformationAasRepository({
230
- client,
231
- path: { aasIdentifier },
232
- });
233
- if (error) {
234
- console.error('Error from server:', error);
235
- throw new Error(JSON.stringify(error.messages));
236
- }
237
- return (0, convertAasTypes_1.convertApiAssetInformationToCoreAssetInformation)(data);
238
- }
239
- catch (error) {
240
- console.error('Error fetching Asset Information:', error);
241
- throw error;
242
- }
243
- });
244
- }
245
- /**
246
- * Updates the Asset Information
247
- *
248
- * @async
249
- * @function putAssetInformation
250
- * @param baseURL The API base URL
251
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
252
- * @param assetInformation Asset Information object
253
- * @param headers Request headers
254
- * @returns {Promise<void>} Asset Information updated successfully
255
- */
256
- putAssetInformation(baseURL, aasIdentifier, assetInformation, headers) {
257
- return __awaiter(this, void 0, void 0, function* () {
258
- try {
259
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
260
- const { error } = yield AasRepository.putAssetInformationAasRepository({
261
- client,
262
- path: { aasIdentifier },
263
- body: (0, convertAasTypes_1.convertCoreAssetInformationToApiAssetInformation)(assetInformation),
264
- });
265
- if (error) {
266
- console.error('Error from server:', error);
267
- throw new Error(JSON.stringify(error.messages));
268
- }
269
- return;
270
- }
271
- catch (error) {
272
- console.error('Error updating Asset Information:', error);
273
- throw error;
274
- }
275
- });
276
- }
277
- /**
278
- * Deletes the Thumbnail
279
- *
280
- * @async
281
- * @function deleteThumbnail
282
- * @param baseURL The API base URL
283
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
284
- * @param headers Request headers
285
- * @returns {Promise<void>} Thumbnail deletion successful
286
- */
287
- deleteThumbnail(baseURL, aasIdentifier, headers) {
288
- return __awaiter(this, void 0, void 0, function* () {
289
- try {
290
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
291
- const { error } = yield AasRepository.deleteThumbnailAasRepository({
292
- client,
293
- path: { aasIdentifier },
294
- });
295
- if (error) {
296
- console.error('Error from server:', error);
297
- throw new Error(JSON.stringify(error.messages));
298
- }
299
- return;
300
- }
301
- catch (error) {
302
- console.error('Error deleting Thumbnail:', error);
303
- throw error;
304
- }
305
- });
306
- }
307
- /**
308
- * Returns the Thumbnail
309
- *
310
- * @async
311
- * @function getThumbnail
312
- * @param baseURL The API base URL
313
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
314
- * @param headers Request headers
315
- * @returns {Promise<Blob | File>} The thumbnail of the Asset Information.
316
- */
317
- getThumbnail(baseURL, aasIdentifier, headers) {
318
- return __awaiter(this, void 0, void 0, function* () {
319
- try {
320
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
321
- const { data, error } = yield AasRepository.getThumbnailAasRepository({
322
- client,
323
- path: { aasIdentifier },
324
- });
325
- if (error) {
326
- console.error('Error from server:', error);
327
- throw new Error(JSON.stringify(error.messages));
328
- }
329
- return data;
330
- }
331
- catch (error) {
332
- console.error('Error fetching Thumbnail:', error);
333
- throw error;
334
- }
335
- });
336
- }
337
- /**
338
- * Updates the Thumbnail
339
- *
340
- * @async
341
- * @function putThumbnail
342
- * @param baseURL The API base URL
343
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
344
- * @param thumbnail Thumbnail to upload
345
- * @param headers Request headers
346
- * @returns {Promise<void>} Thumbnail updated successfully
347
- */
348
- putThumbnail(baseURL, aasIdentifier, thumbnail, headers) {
349
- return __awaiter(this, void 0, void 0, function* () {
350
- try {
351
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
352
- const { error } = yield AasRepository.putThumbnailAasRepository({
353
- client,
354
- path: { aasIdentifier },
355
- body: thumbnail,
356
- });
357
- if (error) {
358
- console.error('Error from server:', error);
359
- throw new Error(JSON.stringify(error.messages));
360
- }
361
- return;
362
- }
363
- catch (error) {
364
- console.error('Error updating Thumbnail:', error);
365
- throw error;
366
- }
367
- });
368
- }
369
- /**
370
- * Returns all submodel references
371
- *
372
- * @async
373
- * @function getAllSubmodelReferences
374
- * @param baseURL The API base URL
375
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
376
- * @param headers Request headers
377
- * @param limit The maximum number of elements in the response array
378
- * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
379
- * @returns {Promise<getAllSubmodelReferencesResponse>} Requested submodel references
380
- */
381
- getAllSubmodelReferences(baseURL, aasIdentifier, headers, limit, cursor) {
382
- return __awaiter(this, void 0, void 0, function* () {
383
- var _a;
384
- try {
385
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
386
- const { data, error } = yield AasRepository.getAllSubmodelReferencesAasRepository({
387
- client,
388
- path: { aasIdentifier },
389
- query: {
390
- limit,
391
- cursor,
392
- },
393
- });
394
- if (error) {
395
- console.error('Error from server:', error);
396
- throw new Error(JSON.stringify(error.messages));
397
- }
398
- const submodelReferences = ((_a = data.result) !== null && _a !== void 0 ? _a : []).map(convertAasTypes_1.convertApiReferenceToCoreReference);
399
- return {
400
- pagedResult: data.paging_metadata,
401
- result: submodelReferences,
402
- };
403
- }
404
- catch (error) {
405
- console.error('Error fetching Submodel References:', error);
406
- throw error;
407
- }
408
- });
409
- }
410
- /**
411
- * Creates a submodel reference at the Asset Administration Shell
412
- *
413
- * @async
414
- * @function postSubmodelReference
415
- * @param baseURL The API base URL
416
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
417
- * @param submodelReference Reference to the Submodel
418
- * @param headers Request headers
419
- * @returns {promise<Reference>} Submodel reference created successfully
420
- */
421
- postSubmodelReference(baseURL, aasIdentifier, submodelReference, headers) {
422
- return __awaiter(this, void 0, void 0, function* () {
423
- try {
424
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
425
- const { data, error } = yield AasRepository.postSubmodelReferenceAasRepository({
426
- client,
427
- path: { aasIdentifier },
428
- body: (0, convertAasTypes_1.convertCoreReferenceToApiReference)(submodelReference),
429
- });
430
- if (error) {
431
- console.error('Error from server:', error);
432
- throw new Error(JSON.stringify(error.messages));
433
- }
434
- return (0, convertAasTypes_1.convertApiReferenceToCoreReference)(data);
435
- }
436
- catch (error) {
437
- console.error('Error creating Submodel Reference:', error);
438
- throw error;
439
- }
440
- });
441
- }
442
- /**
443
- * Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
444
- *
445
- * @async
446
- * @function deleteSubmodelReferenceById
447
- * @param baseURL The API base URL
448
- * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
449
- * @param submodelIdentifier The Submodel’s unique id (UTF8-BASE64-URL-encoded)
450
- * @param headers Request headers
451
- * @returns {Promise<void>} Submodel reference deleted successfully
452
- */
453
- deleteSubmodelReferenceById(baseURL, aasIdentifier, submodelIdentifier, headers) {
454
- return __awaiter(this, void 0, void 0, function* () {
455
- try {
456
- const client = (0, createAasRepoClient_1.createCustomClient)(baseURL, headers);
457
- const { error } = yield AasRepository.deleteSubmodelReferenceByIdAasRepository({
458
- client,
459
- path: { aasIdentifier, submodelIdentifier },
460
- });
461
- if (error) {
462
- console.error('Error from server:', error);
463
- throw new Error(JSON.stringify(error.messages));
464
- }
465
- return;
466
- }
467
- catch (error) {
468
- console.error('Error deleting Submodel Reference:', error);
469
- throw error;
470
- }
471
- });
472
- }
473
- }
474
- exports.AasRepositoryClient = AasRepositoryClient;
@@ -1 +0,0 @@
1
- export { AasRepositoryClient } from './AasRepositoryClient';