basyx-typescript-sdk 0.1.8 → 0.1.10

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 CHANGED
@@ -1,17 +1,1010 @@
1
- var __createBinding = (undefined && undefined.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __exportStar = (undefined && undefined.__exportStar) || function(m, exports) {
13
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
- };
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- __exportStar(require("./clients"), exports);
1
+ import { createClient, createConfig, formDataBodySerializer } from '@hey-api/client-fetch';
2
+ import { jsonization } from '@aas-core-works/aas-core3.0-typescript';
3
+
4
+ // This file is auto-generated by @hey-api/openapi-ts
5
+ const client = createClient(createConfig());
6
+ /**
7
+ * Returns all Asset Administration Shells
8
+ */
9
+ const getAllAssetAdministrationShells = (options) => {
10
+ return (options?.client ?? client).get({
11
+ url: '/shells',
12
+ ...options,
13
+ });
14
+ };
15
+ /**
16
+ * Creates a new Asset Administration Shell
17
+ */
18
+ const postAssetAdministrationShell = (options) => {
19
+ return (options?.client ?? client).post({
20
+ url: '/shells',
21
+ ...options,
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ ...options?.headers,
25
+ },
26
+ });
27
+ };
28
+ /**
29
+ * Deletes an Asset Administration Shell
30
+ */
31
+ const deleteAssetAdministrationShellById = (options) => {
32
+ return (options?.client ?? client).delete({
33
+ url: '/shells/{aasIdentifier}',
34
+ ...options,
35
+ });
36
+ };
37
+ /**
38
+ * Returns a specific Asset Administration Shell
39
+ */
40
+ const getAssetAdministrationShellById = (options) => {
41
+ return (options?.client ?? client).get({
42
+ url: '/shells/{aasIdentifier}',
43
+ ...options,
44
+ });
45
+ };
46
+ /**
47
+ * Updates an existing Asset Administration Shell
48
+ */
49
+ const putAssetAdministrationShellById = (options) => {
50
+ return (options?.client ?? client).put({
51
+ url: '/shells/{aasIdentifier}',
52
+ ...options,
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ ...options?.headers,
56
+ },
57
+ });
58
+ };
59
+ /**
60
+ * Returns the Asset Information
61
+ */
62
+ const getAssetInformationAasRepository = (options) => {
63
+ return (options?.client ?? client).get({
64
+ url: '/shells/{aasIdentifier}/asset-information',
65
+ ...options,
66
+ });
67
+ };
68
+ /**
69
+ * Updates the Asset Information
70
+ */
71
+ const putAssetInformationAasRepository = (options) => {
72
+ return (options?.client ?? client).put({
73
+ url: '/shells/{aasIdentifier}/asset-information',
74
+ ...options,
75
+ headers: {
76
+ 'Content-Type': 'application/json',
77
+ ...options?.headers,
78
+ },
79
+ });
80
+ };
81
+ const deleteThumbnailAasRepository = (options) => {
82
+ return (options?.client ?? client).delete({
83
+ url: '/shells/{aasIdentifier}/asset-information/thumbnail',
84
+ ...options,
85
+ });
86
+ };
87
+ const getThumbnailAasRepository = (options) => {
88
+ return (options?.client ?? client).get({
89
+ url: '/shells/{aasIdentifier}/asset-information/thumbnail',
90
+ ...options,
91
+ });
92
+ };
93
+ const putThumbnailAasRepository = (options) => {
94
+ return (options?.client ?? client).put({
95
+ ...formDataBodySerializer,
96
+ url: '/shells/{aasIdentifier}/asset-information/thumbnail',
97
+ ...options,
98
+ headers: {
99
+ 'Content-Type': null,
100
+ ...options?.headers,
101
+ },
102
+ });
103
+ };
104
+ /**
105
+ * Returns all submodel references
106
+ */
107
+ const getAllSubmodelReferencesAasRepository = (options) => {
108
+ return (options?.client ?? client).get({
109
+ url: '/shells/{aasIdentifier}/submodel-refs',
110
+ ...options,
111
+ });
112
+ };
113
+ /**
114
+ * Creates a submodel reference at the Asset Administration Shell
115
+ */
116
+ const postSubmodelReferenceAasRepository = (options) => {
117
+ return (options?.client ?? client).post({
118
+ url: '/shells/{aasIdentifier}/submodel-refs',
119
+ ...options,
120
+ headers: {
121
+ 'Content-Type': 'application/json',
122
+ ...options?.headers,
123
+ },
124
+ });
125
+ };
126
+ /**
127
+ * Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
128
+ */
129
+ const deleteSubmodelReferenceByIdAasRepository = (options) => {
130
+ return (options?.client ?? client).delete({
131
+ url: '/shells/{aasIdentifier}/submodel-refs/{submodelIdentifier}',
132
+ ...options,
133
+ });
134
+ };
135
+
136
+ /**
137
+ * Provide an implementation of the Asset Administration Shell (AAS) V3.0.
138
+ *
139
+ * @remarks
140
+ * The presented version of the Metamodel is related to the work of
141
+ * aas-core-works, which can be found here: https://github.com/aas-core-works.
142
+ *
143
+ * The presented content is neither related to the IDTA nor
144
+ * Plattform Industrie 4.0 and does not represent an official publication.
145
+ *
146
+ * We diverge from the book in the following points.
147
+ *
148
+ * We did not implement the following constraints as they are too general and can not
149
+ * be formalized as part of the core library, but affects external components such as
150
+ * AAS registry or AAS server:
151
+ *
152
+ * * Constraint AASd-022
153
+ *
154
+ * We did not implement the following constraints since they depend on registry and
155
+ * de-referencing of {@link Reference} objects:
156
+ *
157
+ * * Constraint AASd-006
158
+ * * Constraint AASd-007
159
+ * * Constraint AASc-3a-003
160
+ *
161
+ * Some constraints are not enforceable as they depend on the wider context
162
+ * such as language understanding, so we could not formalize them:
163
+ *
164
+ * * Constraint AASd-012: This constraint requires that the texts inside
165
+ * `Multi_language_property` shall have the same meanings in the separate languages.
166
+ * This cannot be tested.
167
+ * * Constraint AASd-116: In the book, Constraint AASd-116 imposes a
168
+ * case-insensitive equality against `globalAssetId`. This is culturally-dependent,
169
+ * and depends on the system settings. For example, the case-folding
170
+ * for the letters "i" and "I" is different in Turkish from English.
171
+ *
172
+ * We implement the constraint as case-sensitive instead to allow for interoperability
173
+ * across different culture settings.
174
+ *
175
+ * Furthermore, we diverge from the book in the following points regarding
176
+ * the enumerations. We have to implement subsets of enumerations as sets as common
177
+ * programming languages do not support inheritance of enumerations. The relationship
178
+ * between the properties and the sets is defined through invariants. This causes
179
+ * the following divergences:
180
+ *
181
+ * * We decided therefore to remove the enumeration `DataTypeDefRDF`
182
+ * and keep only {@link DataTypeDefXsd} as enumeration. Otherwise, we would have
183
+ * to write redundant invariants all over the meta-model because `DataTypeDefRDF`
184
+ * is actually never used in any type definition.
185
+ * * The enumeration {@link AasSubmodelElements} is used in two different contexts.
186
+ * One context is the definition of key types in a reference. Another context is
187
+ * the definition of element types in a {@link SubmodelElementList}.
188
+ *
189
+ * To avoid confusion, we introduce two separate enumerations for the separate contexts.
190
+ * Firstly, a set of {@link KeyTypes}, {@link constants!AAS_SUBMODEL_ELEMENTS_AS_KEYS} to
191
+ * represent the first context (key type in a reference).
192
+ * Secondly, the enumeration {@link AasSubmodelElements} is kept as designator
193
+ * for {@link SubmodelElementList.typeValueListElement}.
194
+ * * The specification introduces several types of `Lang_string_set`.
195
+ * These types differ between the allowed length of their text inside the singular
196
+ * `Lang_string` objects. Since the native representation of `Lang_string_set` as
197
+ * `List` of `Lang_string` is required by specification, it is impossible to
198
+ * introduce separate `Lang_string_set` types. Therefore, the distinction is drawn here
199
+ * between the `Lang_string` types.
200
+ *
201
+ * `DefinitionTypeIEC61360` is represented as a
202
+ * `List` of {@link LangStringDefinitionTypeIec61360}
203
+ *
204
+ * `MultiLanguageNameType` is represented as a
205
+ * `List` of {@link LangStringNameType}
206
+ *
207
+ * `PreferredNameTypeIEC61360` is represented as a
208
+ * `List` of {@link LangStringPreferredNameTypeIec61360}
209
+ *
210
+ * `ShortNameTypeIEC61360` is represented as a
211
+ * `List` of {@link LangStringShortNameTypeIec61360}
212
+ *
213
+ * `MultiLanguageTextType` is represented as a
214
+ * `List` of {@link LangStringTextType}
215
+ *
216
+ * Furthermore, since `Lang_string` is not used anywhere, we rename it to
217
+ * {@link IAbstractLangString}.
218
+ *
219
+ * Concerning the data specifications, we embed them within
220
+ * {@link IHasDataSpecification} instead of referencing them *via* an external reference.
221
+ * The working group decided to change the rules for serialization *after* the book was
222
+ * published. The data specifications are critical in applications, but there is no
223
+ * possibility to access them through a data channel as they are not part of
224
+ * an environment.
225
+ */ // This code has been automatically generated by aas-core-codegen.
226
+ // Do NOT edit or append.
227
+ /**
228
+ * Represent the most general class of an AAS model.
229
+ */class Class{}/**
230
+ * An asset administration shell.
231
+ */class AssetAdministrationShell extends Class{/**
232
+ * Indicate the runtime model type of the instance.
233
+ */modelType(){// NOTE (mristin, 2022-12-03):
234
+ // We yield numbers instead of literals to avoid name lookups on platforms
235
+ // which do not provide JIT compilation of hot paths.
236
+ return 3;// AssetAdministrationShell
237
+ }/**
238
+ * An extension of the element.
239
+ */ /**
240
+ * Yield from {@link extensions} if it is set, or yield nothing.
241
+ */*overExtensionsOrEmpty(){if(this.extensions!==null){yield*this.extensions;}return;}/**
242
+ * Yield from {@link displayName} if it is set, or yield nothing.
243
+ */*overDisplayNameOrEmpty(){if(this.displayName!==null){yield*this.displayName;}return;}/**
244
+ * Yield from {@link description} if it is set, or yield nothing.
245
+ */*overDescriptionOrEmpty(){if(this.description!==null){yield*this.description;}return;}/**
246
+ * Yield from {@link embeddedDataSpecifications} if it is set, or yield nothing.
247
+ */*overEmbeddedDataSpecificationsOrEmpty(){if(this.embeddedDataSpecifications!==null){yield*this.embeddedDataSpecifications;}return;}/**
248
+ * Yield from {@link submodels} if it is set, or yield nothing.
249
+ */*overSubmodelsOrEmpty(){if(this.submodels!==null){yield*this.submodels;}return;}/**
250
+ * Iterate over the instances referenced from this instance.
251
+ *
252
+ * We do not recurse into the referenced instances.
253
+ *
254
+ * @returns Iterator over the referenced instances
255
+ */*descendOnce(){if(this.extensions!==null){yield*this.extensions;}if(this.displayName!==null){yield*this.displayName;}if(this.description!==null){yield*this.description;}if(this.administration!==null){yield this.administration;}if(this.embeddedDataSpecifications!==null){yield*this.embeddedDataSpecifications;}if(this.derivedFrom!==null){yield this.derivedFrom;}yield this.assetInformation;if(this.submodels!==null){yield*this.submodels;}}/**
256
+ * Iterate recursively over the instances referenced from this instance.
257
+ *
258
+ * @returns Iterator over the referenced instances
259
+ */*descend(){if(this.extensions!==null){for(const anItem of this.extensions){yield anItem;yield*anItem.descend();}}if(this.displayName!==null){for(const anotherItem of this.displayName){yield anotherItem;yield*anotherItem.descend();}}if(this.description!==null){for(const yetAnotherItem of this.description){yield yetAnotherItem;yield*yetAnotherItem.descend();}}if(this.administration!==null){yield this.administration;yield*this.administration.descend();}if(this.embeddedDataSpecifications!==null){for(const yetYetAnotherItem of this.embeddedDataSpecifications){yield yetYetAnotherItem;yield*yetYetAnotherItem.descend();}}if(this.derivedFrom!==null){yield this.derivedFrom;yield*this.derivedFrom.descend();}yield this.assetInformation;yield*this.assetInformation.descend();if(this.submodels!==null){for(const yetYetYetAnotherItem of this.submodels){yield yetYetYetAnotherItem;yield*yetYetYetAnotherItem.descend();}}}/**
260
+ * Dispatch `visitor` on this instance.
261
+ *
262
+ * @param visitor - to visit this instance
263
+ */accept(visitor){visitor.visitAssetAdministrationShell(this);}/**
264
+ * Dispatch `visitor` with `context` on this instance.
265
+ *
266
+ * @param visitor - to visit this instance
267
+ * @param context - to be passed along to the dispatched visitor method
268
+ * @typeParam ContextT - type of the context
269
+ */acceptWithContext(visitor,context){visitor.visitAssetAdministrationShellWithContext(this,context);}/**
270
+ * Dispatch the `transformer` on this instance.
271
+ *
272
+ * @param transformer - to transform this instance
273
+ * @returns transformation of this instance
274
+ * @paramType T - type of the transformation result
275
+ */transform(transformer){return transformer.transformAssetAdministrationShell(this);}/**
276
+ * Dispatch the `transformer` on this instance in `context`.
277
+ *
278
+ * @param transformer - to transform this instance
279
+ * @param context - to be passed along to the `transformer`
280
+ * @returns transformation of this instance
281
+ * @paramType T - type of the transformation result
282
+ * @paramType ContextT - type of the transformation context
283
+ */transformWithContext(transformer,context){return transformer.transformAssetAdministrationShellWithContext(this,context);}constructor(id,assetInformation,extensions=null,category=null,idShort=null,displayName=null,description=null,administration=null,embeddedDataSpecifications=null,derivedFrom=null,submodels=null){super();this.extensions=extensions;this.idShort=idShort;this.displayName=displayName;this.category=category;this.description=description;this.id=id;this.administration=administration;this.embeddedDataSpecifications=embeddedDataSpecifications;this.derivedFrom=derivedFrom;this.assetInformation=assetInformation;this.submodels=submodels;}}/**
284
+ * In {@link AssetInformation} identifying meta data of the asset that is
285
+ * represented by an AAS is defined.
286
+ *
287
+ * @remarks
288
+ * The asset may either represent an asset type or an asset instance.
289
+ *
290
+ * The asset has a globally unique identifier plus – if needed – additional domain
291
+ * specific (proprietary) identifiers. However, to support the corner case of very
292
+ * first phase of lifecycle where a stabilised/constant_set global asset identifier
293
+ * does not already exist, the corresponding attribute {@link AssetInformation.globalAssetId} is
294
+ * optional.
295
+ *
296
+ * Constraint `AASd-116`:
297
+ * `globalAssetId` is a reserved key. If used as value for
298
+ * {@link SpecificAssetId.name} then {@link SpecificAssetId.value} shall be
299
+ * identical to {@link AssetInformation.globalAssetId}.
300
+ *
301
+ * **Note**:
302
+ * Constraint AASd-116 is important to enable a generic search across
303
+ * global and specific asset IDs.
304
+ *
305
+ * **Note**:
306
+ * In the book, Constraint AASd-116 imposes a
307
+ * case-insensitive equality against `globalAssetId`. This is
308
+ * culturally-dependent, and depends on the system settings.
309
+ * For example, the case-folding for the letters "i" and "I" is
310
+ * different in Turkish from English.
311
+ *
312
+ * We implement the constraint as case-sensitive instead to allow
313
+ * for interoperability across different culture settings.
314
+ *
315
+ * Constraint `AASd-131`:
316
+ * For {@link AssetInformation} either the {@link AssetInformation.globalAssetId} shall be
317
+ * defined or at least one item in {@link AssetInformation.specificAssetIds}.
318
+ */class AssetInformation extends Class{/**
319
+ * Indicate the runtime model type of the instance.
320
+ */modelType(){// NOTE (mristin, 2022-12-03):
321
+ // We yield numbers instead of literals to avoid name lookups on platforms
322
+ // which do not provide JIT compilation of hot paths.
323
+ return 4;// AssetInformation
324
+ }/**
325
+ * Denotes whether the Asset is of kind {@link AssetKind.Type} or
326
+ * {@link AssetKind.Instance}.
327
+ */ /**
328
+ * Yield from {@link specificAssetIds} if it is set, or yield nothing.
329
+ */*overSpecificAssetIdsOrEmpty(){if(this.specificAssetIds!==null){yield*this.specificAssetIds;}return;}/**
330
+ * Iterate over the instances referenced from this instance.
331
+ *
332
+ * We do not recurse into the referenced instances.
333
+ *
334
+ * @returns Iterator over the referenced instances
335
+ */*descendOnce(){if(this.specificAssetIds!==null){yield*this.specificAssetIds;}if(this.defaultThumbnail!==null){yield this.defaultThumbnail;}}/**
336
+ * Iterate recursively over the instances referenced from this instance.
337
+ *
338
+ * @returns Iterator over the referenced instances
339
+ */*descend(){if(this.specificAssetIds!==null){for(const anItem of this.specificAssetIds){yield anItem;yield*anItem.descend();}}if(this.defaultThumbnail!==null){yield this.defaultThumbnail;yield*this.defaultThumbnail.descend();}}/**
340
+ * Dispatch `visitor` on this instance.
341
+ *
342
+ * @param visitor - to visit this instance
343
+ */accept(visitor){visitor.visitAssetInformation(this);}/**
344
+ * Dispatch `visitor` with `context` on this instance.
345
+ *
346
+ * @param visitor - to visit this instance
347
+ * @param context - to be passed along to the dispatched visitor method
348
+ * @typeParam ContextT - type of the context
349
+ */acceptWithContext(visitor,context){visitor.visitAssetInformationWithContext(this,context);}/**
350
+ * Dispatch the `transformer` on this instance.
351
+ *
352
+ * @param transformer - to transform this instance
353
+ * @returns transformation of this instance
354
+ * @paramType T - type of the transformation result
355
+ */transform(transformer){return transformer.transformAssetInformation(this);}/**
356
+ * Dispatch the `transformer` on this instance in `context`.
357
+ *
358
+ * @param transformer - to transform this instance
359
+ * @param context - to be passed along to the `transformer`
360
+ * @returns transformation of this instance
361
+ * @paramType T - type of the transformation result
362
+ * @paramType ContextT - type of the transformation context
363
+ */transformWithContext(transformer,context){return transformer.transformAssetInformationWithContext(this,context);}constructor(assetKind,globalAssetId=null,specificAssetIds=null,assetType=null,defaultThumbnail=null){super();this.assetKind=assetKind;this.globalAssetId=globalAssetId;this.specificAssetIds=specificAssetIds;this.assetType=assetType;this.defaultThumbnail=defaultThumbnail;}}/**
364
+ * Reference to either a model element of the same or another AAS or to an external
365
+ * entity.
366
+ *
367
+ * @remarks
368
+ * A reference is an ordered list of keys.
369
+ *
370
+ * A model reference is an ordered list of keys, each key referencing an element. The
371
+ * complete list of keys may for example be concatenated to a path that then gives
372
+ * unique access to an element.
373
+ *
374
+ * An external reference is a reference to an external entity.
375
+ *
376
+ * Constraint `AASd-121`:
377
+ * For {@link Reference}'s the value of {@link Key.type} of the first key of "
378
+ * {@link Reference.keys} shall be one of {@link constants!GLOBALLY_IDENTIFIABLES}.
379
+ *
380
+ * Constraint `AASd-122`:
381
+ * For external references, i.e. {@link Reference}'s with
382
+ * {@link Reference.type} = {@link ReferenceTypes.ExternalReference}, the value
383
+ * of {@link Key.type} of the first key of {@link Reference.keys} shall be one of
384
+ * {@link constants!GENERIC_GLOBALLY_IDENTIFIABLES}.
385
+ *
386
+ * Constraint `AASd-123`:
387
+ * For model references, i.e. {@link Reference}'s with
388
+ * {@link Reference.type} = {@link ReferenceTypes.ModelReference}, the value
389
+ * of {@link Key.type} of the first key of {@link Reference.keys} shall be one of
390
+ * {@link constants!AAS_IDENTIFIABLES}.
391
+ *
392
+ * Constraint `AASd-124`:
393
+ * For external references, i.e. {@link Reference}'s with
394
+ * {@link Reference.type} = {@link ReferenceTypes.ExternalReference}, the last
395
+ * key of {@link Reference.keys} shall be either one of
396
+ * {@link constants!GENERIC_GLOBALLY_IDENTIFIABLES} or one of
397
+ * {@link constants!GENERIC_FRAGMENT_KEYS}.
398
+ *
399
+ * Constraint `AASd-125`:
400
+ * For model references, i.e. {@link Reference}'s with
401
+ * {@link Reference.type} = {@link ReferenceTypes.ModelReference}, with more
402
+ * than one key in {@link Reference.keys} the value of {@link Key.type}
403
+ * of each of the keys following the first
404
+ * key of {@link Reference.keys} shall be one of {@link constants!FRAGMENT_KEYS}.
405
+ *
406
+ * **Note**:
407
+ * Constraint AASd-125 ensures that the shortest path is used.
408
+ *
409
+ * Constraint `AASd-126`:
410
+ * For model references, i.e. {@link Reference}'s with
411
+ * {@link Reference.type} = {@link ReferenceTypes.ModelReference}, with more
412
+ * than one key in {@link Reference.keys} the value of {@link Key.type}
413
+ * of the last key in the reference key chain may be
414
+ * one of {@link constants!GENERIC_FRAGMENT_KEYS} or no key at all
415
+ * shall have a value out of {@link constants!GENERIC_FRAGMENT_KEYS}.
416
+ *
417
+ * Constraint `AASd-127`:
418
+ * For model references, i.e. {@link Reference}'s with
419
+ * {@link Reference.type} = {@link ReferenceTypes.ModelReference}, with more
420
+ * than one key in {@link Reference.keys} a key with {@link Key.type}
421
+ * {@link KeyTypes.FragmentReference} shall be preceded by a key with
422
+ * {@link Key.type} {@link KeyTypes.File} or {@link KeyTypes.Blob}. All other
423
+ * AAS fragments, i.e. {@link Key.type} values
424
+ * out of {@link constants!AAS_SUBMODEL_ELEMENTS_AS_KEYS}, do not support fragments.
425
+ *
426
+ * **Note**:
427
+ * Which kind of fragments are supported depends on the content type and the
428
+ * specification of allowed fragment identifiers for the corresponding resource
429
+ * being referenced via the reference.
430
+ *
431
+ * Constraint `AASd-128`:
432
+ * For model references, i.e. {@link Reference}'s with
433
+ * {@link Reference.type} = {@link ReferenceTypes.ModelReference}, the
434
+ * {@link Key.value} of a {@link Key} preceded by a {@link Key} with
435
+ * {@link Key.type} = {@link KeyTypes.SubmodelElementList} is an integer
436
+ * number denoting the position in the array of the submodel element list.
437
+ */class Reference extends Class{/**
438
+ * Indicate the runtime model type of the instance.
439
+ */modelType(){// NOTE (mristin, 2022-12-03):
440
+ // We yield numbers instead of literals to avoid name lookups on platforms
441
+ // which do not provide JIT compilation of hot paths.
442
+ return 25;// Reference
443
+ }/**
444
+ * Type of the reference.
445
+ *
446
+ * @remarks
447
+ * Denotes, whether reference is an external reference or a model reference.
448
+ */ /**
449
+ * Iterate over the instances referenced from this instance.
450
+ *
451
+ * We do not recurse into the referenced instances.
452
+ *
453
+ * @returns Iterator over the referenced instances
454
+ */*descendOnce(){if(this.referredSemanticId!==null){yield this.referredSemanticId;}yield*this.keys;}/**
455
+ * Iterate recursively over the instances referenced from this instance.
456
+ *
457
+ * @returns Iterator over the referenced instances
458
+ */*descend(){if(this.referredSemanticId!==null){yield this.referredSemanticId;yield*this.referredSemanticId.descend();}for(const anItem of this.keys){yield anItem;yield*anItem.descend();}}/**
459
+ * Dispatch `visitor` on this instance.
460
+ *
461
+ * @param visitor - to visit this instance
462
+ */accept(visitor){visitor.visitReference(this);}/**
463
+ * Dispatch `visitor` with `context` on this instance.
464
+ *
465
+ * @param visitor - to visit this instance
466
+ * @param context - to be passed along to the dispatched visitor method
467
+ * @typeParam ContextT - type of the context
468
+ */acceptWithContext(visitor,context){visitor.visitReferenceWithContext(this,context);}/**
469
+ * Dispatch the `transformer` on this instance.
470
+ *
471
+ * @param transformer - to transform this instance
472
+ * @returns transformation of this instance
473
+ * @paramType T - type of the transformation result
474
+ */transform(transformer){return transformer.transformReference(this);}/**
475
+ * Dispatch the `transformer` on this instance in `context`.
476
+ *
477
+ * @param transformer - to transform this instance
478
+ * @param context - to be passed along to the `transformer`
479
+ * @returns transformation of this instance
480
+ * @paramType T - type of the transformation result
481
+ * @paramType ContextT - type of the transformation context
482
+ */transformWithContext(transformer,context){return transformer.transformReferenceWithContext(this,context);}constructor(type,keys,referredSemanticId=null){super();this.type=type;this.keys=keys;this.referredSemanticId=referredSemanticId;}}// Do NOT edit or append.
483
+
484
+ /**
485
+ * Convert an API AssetAdministrationShell to a Core Works AssetAdministrationShell
486
+ *
487
+ * @function convertApiAasToCoreAas
488
+ * @param {ApiAssetAdministrationShell} aas - The API AssetAdministrationShell to convert
489
+ * @returns {CoreAssetAdministrationShell} The Core Works AssetAdministrationShell
490
+ */
491
+ function convertApiAasToCoreAas(aas) {
492
+ // first stringify
493
+ let shell = JSON.stringify(aas);
494
+ // then parse
495
+ shell = JSON.parse(shell);
496
+ // then jsonize
497
+ const instanceOrError = jsonization.assetAdministrationShellFromJsonable(shell);
498
+ if (instanceOrError.error !== null) {
499
+ throw instanceOrError.error;
500
+ }
501
+ const instance = instanceOrError.mustValue();
502
+ // set the prototype
503
+ Object.setPrototypeOf(instance, AssetAdministrationShell.prototype);
504
+ return instance;
505
+ }
506
+ /**
507
+ * Convert a Core Works AssetAdministrationShell to an API AssetAdministrationShell
508
+ *
509
+ * @function convertCoreAasToApiAas
510
+ * @param {CoreAssetAdministrationShell} aas - The Core Works AssetAdministrationShell to convert
511
+ * @returns {ApiAssetAdministrationShell} The API AssetAdministrationShell
512
+ */
513
+ function convertCoreAasToApiAas(aas) {
514
+ // first jsonize
515
+ const jsonableAas = jsonization.toJsonable(aas);
516
+ // then stringify
517
+ const shell = JSON.stringify(jsonableAas);
518
+ // then parse
519
+ return JSON.parse(shell);
520
+ }
521
+ /**
522
+ * Convert an API AssetInformation to a Core Works AssetInformation
523
+ *
524
+ * @function convertApiAssetInformationToCoreAssetInformation
525
+ * @param {ApiAssetInformation} assetInformation - The API AssetInformation to convert
526
+ * @returns {CoreAssetInformation} The Core Works AssetInformation
527
+ */
528
+ function convertApiAssetInformationToCoreAssetInformation(assetInformation) {
529
+ // first stringify
530
+ let asset = JSON.stringify(assetInformation);
531
+ // then parse
532
+ asset = JSON.parse(asset);
533
+ // then jsonize
534
+ const instanceOrError = jsonization.assetInformationFromJsonable(asset);
535
+ if (instanceOrError.error !== null) {
536
+ throw instanceOrError.error;
537
+ }
538
+ const instance = instanceOrError.mustValue();
539
+ // set the prototype
540
+ Object.setPrototypeOf(instance, AssetInformation.prototype);
541
+ return instance;
542
+ }
543
+ /**
544
+ * Convert a Core Works AssetInformation to an API AssetInformation
545
+ *
546
+ * @function convertCoreAssetInformationToApiAssetInformation
547
+ * @param {CoreAssetInformation} assetInformation - The Core Works AssetInformation to convert
548
+ * @returns {ApiAssetInformation} The API AssetInformation
549
+ */
550
+ function convertCoreAssetInformationToApiAssetInformation(assetInformation) {
551
+ // first jsonize
552
+ const jsonableAsset = jsonization.toJsonable(assetInformation);
553
+ // then stringify
554
+ const asset = JSON.stringify(jsonableAsset);
555
+ // then parse
556
+ return JSON.parse(asset);
557
+ }
558
+ /**
559
+ * Convert an API Reference to a Core Works Reference
560
+ *
561
+ * @function convertApiReferenceToCoreReference
562
+ * @param {ApiReference} reference - The API Reference to convert
563
+ * @returns {CoreReference} The Core Works Reference
564
+ */
565
+ function convertApiReferenceToCoreReference(reference) {
566
+ // first stringify
567
+ let ref = JSON.stringify(reference);
568
+ // then parse
569
+ ref = JSON.parse(ref);
570
+ // then jsonize
571
+ const instanceOrError = jsonization.referenceFromJsonable(ref);
572
+ if (instanceOrError.error !== null) {
573
+ throw instanceOrError.error;
574
+ }
575
+ const instance = instanceOrError.mustValue();
576
+ // set the prototype
577
+ Object.setPrototypeOf(instance, Reference.prototype);
578
+ return instance;
579
+ }
580
+ /**
581
+ * Convert a Core Works Reference to an API Reference
582
+ *
583
+ * @function convertCoreReferenceToApiReference
584
+ * @param {CoreReference} reference - The Core Works Reference to convert
585
+ * @returns {ApiReference} The API Reference
586
+ */
587
+ function convertCoreReferenceToApiReference(reference) {
588
+ // first jsonize
589
+ const jsonableRef = jsonization.toJsonable(reference);
590
+ // then stringify
591
+ const ref = JSON.stringify(jsonableRef);
592
+ // then parse
593
+ return JSON.parse(ref);
594
+ }
595
+
596
+ /**
597
+ * Creates a custom client configuration
598
+ *
599
+ * @function createCustomClient
600
+ * @param baseURL The base URL of the API
601
+ * @param headers The headers to be included in the request
602
+ * @returns {Client} The custom client
603
+ */
604
+ function createCustomClient(baseURL, headers = new Headers()) {
605
+ return createClient({
606
+ baseUrl: baseURL,
607
+ headers,
608
+ });
609
+ }
610
+
611
+ class AasRepositoryClient {
612
+ /**
613
+ * Returns all Asset Administration Shells
614
+ *
615
+ * @async
616
+ * @function getAllAssetAdministrationShells
617
+ * @param baseURL The API base URL
618
+ * @param headers Request headers
619
+ * @param assetIds A list of specific Asset identifiers. Every single value asset identifier is a base64-url-encoded
620
+ * @param idShort The Asset Administration Shell’s IdShort
621
+ * @param limit The maximum number of elements in the response array
622
+ * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
623
+ * @returns {Promise<GetAllAssetAdministrationShellsResponse>} Requested Asset Administration Shells
624
+ */
625
+ async getAllAssetAdministrationShells(baseURL, headers, assetIds, idShort, limit, cursor) {
626
+ try {
627
+ const client = createCustomClient(baseURL, headers);
628
+ const { data, error } = await getAllAssetAdministrationShells({
629
+ client,
630
+ query: {
631
+ assetIds,
632
+ idShort,
633
+ limit,
634
+ cursor,
635
+ },
636
+ });
637
+ if (error) {
638
+ console.error('Error from server:', error);
639
+ throw new Error(JSON.stringify(error.messages));
640
+ }
641
+ const shells = (data.result ?? []).map(convertApiAasToCoreAas);
642
+ return {
643
+ pagedResult: data.paging_metadata,
644
+ result: shells,
645
+ };
646
+ }
647
+ catch (error) {
648
+ console.error('Error fetching Asset Administration Shells:', error);
649
+ throw error;
650
+ }
651
+ }
652
+ /**
653
+ * Creates a new Asset Administration Shell
654
+ *
655
+ * @async
656
+ * @function postAssetAdministrationShell
657
+ * @param baseURL The API base URL
658
+ * @param assetAdministrationShell Asset Administration Shell object
659
+ * @param headers Request headers
660
+ * @returns {Promise<AssetAdministrationShell>} Asset Administration Shell created successfully
661
+ */
662
+ async postAssetAdministrationShell(baseURL, assetAdministrationShell, headers) {
663
+ try {
664
+ const client = createCustomClient(baseURL, headers);
665
+ const { data, error } = await postAssetAdministrationShell({
666
+ client,
667
+ body: convertCoreAasToApiAas(assetAdministrationShell),
668
+ });
669
+ if (error) {
670
+ console.error('Error from server:', error);
671
+ throw new Error(JSON.stringify(error.messages));
672
+ }
673
+ return convertApiAasToCoreAas(data);
674
+ }
675
+ catch (error) {
676
+ console.error('Error creating Asset Administration Shell:', error);
677
+ throw error;
678
+ }
679
+ }
680
+ /**
681
+ * Deletes an Asset Administration Shell
682
+ *
683
+ * @async
684
+ * @function deleteAssetAdministrationShellById
685
+ * @param baseURL The API base URL
686
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
687
+ * @param headers Request headers
688
+ * @returns {Promise<void>} Asset Administration Shell deleted successfully
689
+ */
690
+ async deleteAssetAdministrationShellById(baseURL, aasIdentifier, headers) {
691
+ try {
692
+ const client = createCustomClient(baseURL, headers);
693
+ const { error } = await deleteAssetAdministrationShellById({
694
+ client,
695
+ path: { aasIdentifier },
696
+ });
697
+ if (error) {
698
+ console.error('Error from server:', error);
699
+ throw new Error(JSON.stringify(error.messages));
700
+ }
701
+ return;
702
+ }
703
+ catch (error) {
704
+ console.error('Error deleting Asset Administration Shell:', error);
705
+ throw error;
706
+ }
707
+ }
708
+ /**
709
+ * Returns a specific Asset Administration Shell
710
+ *
711
+ * @async
712
+ * @function getAssetAdministrationShellById
713
+ * @param baseURL The API base URL
714
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
715
+ * @param headers Request headers
716
+ * @returns {Promise<AssetAdministrationShell>} Requested Asset Administration Shell
717
+ */
718
+ async getAssetAdministrationShellById(baseURL, aasIdentifier, headers) {
719
+ try {
720
+ const client = createCustomClient(baseURL, headers);
721
+ const { data, error } = await getAssetAdministrationShellById({
722
+ client,
723
+ path: { aasIdentifier },
724
+ });
725
+ if (error) {
726
+ console.error('Error from server:', error);
727
+ throw new Error(JSON.stringify(error.messages));
728
+ }
729
+ return convertApiAasToCoreAas(data);
730
+ }
731
+ catch (error) {
732
+ console.error('Error fetching Asset Administration Shell:', error);
733
+ throw error;
734
+ }
735
+ }
736
+ /**
737
+ * Updates an existing Asset Administration Shell
738
+ *
739
+ * @async
740
+ * @function putAssetAdministrationShellById
741
+ * @param baseURL The API base URL
742
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
743
+ * @param assetAdministrationShell Asset Administration Shell object
744
+ * @param headers Request headers
745
+ * @returns {Promise<void>} Asset Administration Shell updated successfully
746
+ */
747
+ async putAssetAdministrationShellById(baseURL, aasIdentifier, assetAdministrationShell, headers) {
748
+ try {
749
+ const client = createCustomClient(baseURL, headers);
750
+ const { error } = await putAssetAdministrationShellById({
751
+ client,
752
+ path: { aasIdentifier },
753
+ body: convertCoreAasToApiAas(assetAdministrationShell),
754
+ });
755
+ if (error) {
756
+ console.error('Error from server:', error);
757
+ throw new Error(JSON.stringify(error.messages));
758
+ }
759
+ return;
760
+ }
761
+ catch (error) {
762
+ console.error('Error updating Asset Administration Shell:', error);
763
+ throw error;
764
+ }
765
+ }
766
+ /**
767
+ * Returns the Asset Information
768
+ *
769
+ * @async
770
+ * @function getAssetInformation
771
+ * @param baseURL The API base URL
772
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
773
+ * @param headers Request headers
774
+ * @returns {Promise<AssetInformation>} Requested Asset Information
775
+ */
776
+ async getAssetInformation(baseURL, aasIdentifier, headers) {
777
+ try {
778
+ const client = createCustomClient(baseURL, headers);
779
+ const { data, error } = await getAssetInformationAasRepository({
780
+ client,
781
+ path: { aasIdentifier },
782
+ });
783
+ if (error) {
784
+ console.error('Error from server:', error);
785
+ throw new Error(JSON.stringify(error.messages));
786
+ }
787
+ return convertApiAssetInformationToCoreAssetInformation(data);
788
+ }
789
+ catch (error) {
790
+ console.error('Error fetching Asset Information:', error);
791
+ throw error;
792
+ }
793
+ }
794
+ /**
795
+ * Updates the Asset Information
796
+ *
797
+ * @async
798
+ * @function putAssetInformation
799
+ * @param baseURL The API base URL
800
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
801
+ * @param assetInformation Asset Information object
802
+ * @param headers Request headers
803
+ * @returns {Promise<void>} Asset Information updated successfully
804
+ */
805
+ async putAssetInformation(baseURL, aasIdentifier, assetInformation, headers) {
806
+ try {
807
+ const client = createCustomClient(baseURL, headers);
808
+ const { error } = await putAssetInformationAasRepository({
809
+ client,
810
+ path: { aasIdentifier },
811
+ body: convertCoreAssetInformationToApiAssetInformation(assetInformation),
812
+ });
813
+ if (error) {
814
+ console.error('Error from server:', error);
815
+ throw new Error(JSON.stringify(error.messages));
816
+ }
817
+ return;
818
+ }
819
+ catch (error) {
820
+ console.error('Error updating Asset Information:', error);
821
+ throw error;
822
+ }
823
+ }
824
+ /**
825
+ * Deletes the Thumbnail
826
+ *
827
+ * @async
828
+ * @function deleteThumbnail
829
+ * @param baseURL The API base URL
830
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
831
+ * @param headers Request headers
832
+ * @returns {Promise<void>} Thumbnail deletion successful
833
+ */
834
+ async deleteThumbnail(baseURL, aasIdentifier, headers) {
835
+ try {
836
+ const client = createCustomClient(baseURL, headers);
837
+ const { error } = await deleteThumbnailAasRepository({
838
+ client,
839
+ path: { aasIdentifier },
840
+ });
841
+ if (error) {
842
+ console.error('Error from server:', error);
843
+ throw new Error(JSON.stringify(error.messages));
844
+ }
845
+ return;
846
+ }
847
+ catch (error) {
848
+ console.error('Error deleting Thumbnail:', error);
849
+ throw error;
850
+ }
851
+ }
852
+ /**
853
+ * Returns the Thumbnail
854
+ *
855
+ * @async
856
+ * @function getThumbnail
857
+ * @param baseURL The API base URL
858
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
859
+ * @param headers Request headers
860
+ * @returns {Promise<Blob | File>} The thumbnail of the Asset Information.
861
+ */
862
+ async getThumbnail(baseURL, aasIdentifier, headers) {
863
+ try {
864
+ const client = createCustomClient(baseURL, headers);
865
+ const { data, error } = await getThumbnailAasRepository({
866
+ client,
867
+ path: { aasIdentifier },
868
+ });
869
+ if (error) {
870
+ console.error('Error from server:', error);
871
+ throw new Error(JSON.stringify(error.messages));
872
+ }
873
+ return data;
874
+ }
875
+ catch (error) {
876
+ console.error('Error fetching Thumbnail:', error);
877
+ throw error;
878
+ }
879
+ }
880
+ /**
881
+ * Updates the Thumbnail
882
+ *
883
+ * @async
884
+ * @function putThumbnail
885
+ * @param baseURL The API base URL
886
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
887
+ * @param thumbnail Thumbnail to upload
888
+ * @param headers Request headers
889
+ * @returns {Promise<void>} Thumbnail updated successfully
890
+ */
891
+ async putThumbnail(baseURL, aasIdentifier, thumbnail, headers) {
892
+ try {
893
+ const client = createCustomClient(baseURL, headers);
894
+ const { error } = await putThumbnailAasRepository({
895
+ client,
896
+ path: { aasIdentifier },
897
+ body: thumbnail,
898
+ });
899
+ if (error) {
900
+ console.error('Error from server:', error);
901
+ throw new Error(JSON.stringify(error.messages));
902
+ }
903
+ return;
904
+ }
905
+ catch (error) {
906
+ console.error('Error updating Thumbnail:', error);
907
+ throw error;
908
+ }
909
+ }
910
+ /**
911
+ * Returns all submodel references
912
+ *
913
+ * @async
914
+ * @function getAllSubmodelReferences
915
+ * @param baseURL The API base URL
916
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
917
+ * @param headers Request headers
918
+ * @param limit The maximum number of elements in the response array
919
+ * @param cursor A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
920
+ * @returns {Promise<getAllSubmodelReferencesResponse>} Requested submodel references
921
+ */
922
+ async getAllSubmodelReferences(baseURL, aasIdentifier, headers, limit, cursor) {
923
+ try {
924
+ const client = createCustomClient(baseURL, headers);
925
+ const { data, error } = await getAllSubmodelReferencesAasRepository({
926
+ client,
927
+ path: { aasIdentifier },
928
+ query: {
929
+ limit,
930
+ cursor,
931
+ },
932
+ });
933
+ if (error) {
934
+ console.error('Error from server:', error);
935
+ throw new Error(JSON.stringify(error.messages));
936
+ }
937
+ const submodelReferences = (data.result ?? []).map(convertApiReferenceToCoreReference);
938
+ return {
939
+ pagedResult: data.paging_metadata,
940
+ result: submodelReferences,
941
+ };
942
+ }
943
+ catch (error) {
944
+ console.error('Error fetching Submodel References:', error);
945
+ throw error;
946
+ }
947
+ }
948
+ /**
949
+ * Creates a submodel reference at the Asset Administration Shell
950
+ *
951
+ * @async
952
+ * @function postSubmodelReference
953
+ * @param baseURL The API base URL
954
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
955
+ * @param submodelReference Reference to the Submodel
956
+ * @param headers Request headers
957
+ * @returns {promise<Reference>} Submodel reference created successfully
958
+ */
959
+ async postSubmodelReference(baseURL, aasIdentifier, submodelReference, headers) {
960
+ try {
961
+ const client = createCustomClient(baseURL, headers);
962
+ const { data, error } = await postSubmodelReferenceAasRepository({
963
+ client,
964
+ path: { aasIdentifier },
965
+ body: convertCoreReferenceToApiReference(submodelReference),
966
+ });
967
+ if (error) {
968
+ console.error('Error from server:', error);
969
+ throw new Error(JSON.stringify(error.messages));
970
+ }
971
+ return convertApiReferenceToCoreReference(data);
972
+ }
973
+ catch (error) {
974
+ console.error('Error creating Submodel Reference:', error);
975
+ throw error;
976
+ }
977
+ }
978
+ /**
979
+ * Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
980
+ *
981
+ * @async
982
+ * @function deleteSubmodelReferenceById
983
+ * @param baseURL The API base URL
984
+ * @param aasIdentifier The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
985
+ * @param submodelIdentifier The Submodel’s unique id (UTF8-BASE64-URL-encoded)
986
+ * @param headers Request headers
987
+ * @returns {Promise<void>} Submodel reference deleted successfully
988
+ */
989
+ async deleteSubmodelReferenceById(baseURL, aasIdentifier, submodelIdentifier, headers) {
990
+ try {
991
+ const client = createCustomClient(baseURL, headers);
992
+ const { error } = await deleteSubmodelReferenceByIdAasRepository({
993
+ client,
994
+ path: { aasIdentifier, submodelIdentifier },
995
+ });
996
+ if (error) {
997
+ console.error('Error from server:', error);
998
+ throw new Error(JSON.stringify(error.messages));
999
+ }
1000
+ return;
1001
+ }
1002
+ catch (error) {
1003
+ console.error('Error deleting Submodel Reference:', error);
1004
+ throw error;
1005
+ }
1006
+ }
1007
+ }
1008
+
1009
+ export { AasRepositoryClient };
17
1010
  //# sourceMappingURL=index.js.map