• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aas-core-works / aas-core3.0rc02-typescript / 3750309115

pending completion
3750309115

push

github

GitHub
Kick off (#1)

2771 of 3743 branches covered (74.03%)

Branch coverage included in aggregate %.

12381 of 12381 new or added lines in 8 files covered. (100.0%)

11034 of 12381 relevant lines covered (89.12%)

234.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.82
/src/stringification.ts
1
/**
2
 * De/serialize enumerations from and to string representations.
3
 */
4

5
// This code has been automatically generated by aas-core-codegen.
6
// Do NOT edit or append.
7

8
import * as AasTypes from "./types";
9✔
9

10
const MODELING_KIND_FROM_STRING = new Map<string, AasTypes.ModelingKind>([
9✔
11
  ["Template", AasTypes.ModelingKind.Template],
12
  ["Instance", AasTypes.ModelingKind.Instance]
13
]);
14

15
/**
16
 * Parse `text` as a string representation of {@link types!ModelingKind}.
17
 *
18
 * @param text - string representation of {@link types!ModelingKind}
19
 * @returns literal of {@link types!ModelingKind}, if valid, and `null` otherwise
20
 */
21
export function modelingKindFromString(text: string): AasTypes.ModelingKind | null {
9✔
22
  const result = MODELING_KIND_FROM_STRING.get(text);
332✔
23
  return result !== undefined ? result : null;
332✔
24
}
25

26
const MODELING_KIND_TO_STRING = new Map<AasTypes.ModelingKind, string>([
9✔
27
  [AasTypes.ModelingKind.Template, "Template"],
28
  [AasTypes.ModelingKind.Instance, "Instance"]
29
]);
30

31
/**
32
 * Translate {@link types!ModelingKind} to a string.
33
 *
34
 * @param value - to be stringified
35
 * @returns string representation of {@link types!ModelingKind}, if `value` valid, and `null` otherwise
36
 */
37
export function modelingKindToString(value: AasTypes.ModelingKind): string | null {
9✔
38
  const result = MODELING_KIND_TO_STRING.get(value);
×
39
  return result !== undefined ? result : null;
×
40
}
41

42
/**
43
 * Translate {@link types!ModelingKind} to a string.
44
 *
45
 * @param value - to be stringified
46
 * @returns string representation of {@link types!ModelingKind}
47
 * @throws
48
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
49
 * if the `value` is invalid
50
 */
51
export function mustModelingKindToString(value: AasTypes.ModelingKind): string {
9✔
52
  const result = MODELING_KIND_TO_STRING.get(value);
76✔
53
  if (result === undefined) {
76!
54
    throw new Error(`Invalid literal of ModelingKind: ${value}`);
×
55
  }
56
  return result;
76✔
57
}
58

59
const QUALIFIER_KIND_FROM_STRING = new Map<string, AasTypes.QualifierKind>([
9✔
60
  ["ValueQualifier", AasTypes.QualifierKind.ValueQualifier],
61
  ["ConceptQualifier", AasTypes.QualifierKind.ConceptQualifier],
62
  ["TemplateQualifier", AasTypes.QualifierKind.TemplateQualifier]
63
]);
64

65
/**
66
 * Parse `text` as a string representation of {@link types!QualifierKind}.
67
 *
68
 * @param text - string representation of {@link types!QualifierKind}
69
 * @returns literal of {@link types!QualifierKind}, if valid, and `null` otherwise
70
 */
71
export function qualifierKindFromString(text: string): AasTypes.QualifierKind | null {
9✔
72
  const result = QUALIFIER_KIND_FROM_STRING.get(text);
18✔
73
  return result !== undefined ? result : null;
18✔
74
}
75

76
const QUALIFIER_KIND_TO_STRING = new Map<AasTypes.QualifierKind, string>([
9✔
77
  [AasTypes.QualifierKind.ValueQualifier, "ValueQualifier"],
78
  [AasTypes.QualifierKind.ConceptQualifier, "ConceptQualifier"],
79
  [AasTypes.QualifierKind.TemplateQualifier, "TemplateQualifier"]
80
]);
81

82
/**
83
 * Translate {@link types!QualifierKind} to a string.
84
 *
85
 * @param value - to be stringified
86
 * @returns string representation of {@link types!QualifierKind}, if `value` valid, and `null` otherwise
87
 */
88
export function qualifierKindToString(value: AasTypes.QualifierKind): string | null {
9✔
89
  const result = QUALIFIER_KIND_TO_STRING.get(value);
×
90
  return result !== undefined ? result : null;
×
91
}
92

93
/**
94
 * Translate {@link types!QualifierKind} to a string.
95
 *
96
 * @param value - to be stringified
97
 * @returns string representation of {@link types!QualifierKind}
98
 * @throws
99
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
100
 * if the `value` is invalid
101
 */
102
export function mustQualifierKindToString(value: AasTypes.QualifierKind): string {
9✔
103
  const result = QUALIFIER_KIND_TO_STRING.get(value);
5✔
104
  if (result === undefined) {
5!
105
    throw new Error(`Invalid literal of QualifierKind: ${value}`);
×
106
  }
107
  return result;
5✔
108
}
109

110
const ASSET_KIND_FROM_STRING = new Map<string, AasTypes.AssetKind>([
9✔
111
  ["Type", AasTypes.AssetKind.Type],
112
  ["Instance", AasTypes.AssetKind.Instance]
113
]);
114

115
/**
116
 * Parse `text` as a string representation of {@link types!AssetKind}.
117
 *
118
 * @param text - string representation of {@link types!AssetKind}
119
 * @returns literal of {@link types!AssetKind}, if valid, and `null` otherwise
120
 */
121
export function assetKindFromString(text: string): AasTypes.AssetKind | null {
9✔
122
  const result = ASSET_KIND_FROM_STRING.get(text);
1,206✔
123
  return result !== undefined ? result : null;
1,206✔
124
}
125

126
const ASSET_KIND_TO_STRING = new Map<AasTypes.AssetKind, string>([
9✔
127
  [AasTypes.AssetKind.Type, "Type"],
128
  [AasTypes.AssetKind.Instance, "Instance"]
129
]);
130

131
/**
132
 * Translate {@link types!AssetKind} to a string.
133
 *
134
 * @param value - to be stringified
135
 * @returns string representation of {@link types!AssetKind}, if `value` valid, and `null` otherwise
136
 */
137
export function assetKindToString(value: AasTypes.AssetKind): string | null {
9✔
138
  const result = ASSET_KIND_TO_STRING.get(value);
×
139
  return result !== undefined ? result : null;
×
140
}
141

142
/**
143
 * Translate {@link types!AssetKind} to a string.
144
 *
145
 * @param value - to be stringified
146
 * @returns string representation of {@link types!AssetKind}
147
 * @throws
148
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
149
 * if the `value` is invalid
150
 */
151
export function mustAssetKindToString(value: AasTypes.AssetKind): string {
9✔
152
  const result = ASSET_KIND_TO_STRING.get(value);
630✔
153
  if (result === undefined) {
630!
154
    throw new Error(`Invalid literal of AssetKind: ${value}`);
×
155
  }
156
  return result;
630✔
157
}
158

159
const AAS_SUBMODEL_ELEMENTS_FROM_STRING = new Map<string, AasTypes.AasSubmodelElements>(
9✔
160
  [
161
    [
162
      "AnnotatedRelationshipElement",
163
      AasTypes.AasSubmodelElements.AnnotatedRelationshipElement
164
    ],
165
    ["BasicEventElement", AasTypes.AasSubmodelElements.BasicEventElement],
166
    ["Blob", AasTypes.AasSubmodelElements.Blob],
167
    ["Capability", AasTypes.AasSubmodelElements.Capability],
168
    ["DataElement", AasTypes.AasSubmodelElements.DataElement],
169
    ["Entity", AasTypes.AasSubmodelElements.Entity],
170
    ["EventElement", AasTypes.AasSubmodelElements.EventElement],
171
    ["File", AasTypes.AasSubmodelElements.File],
172
    ["MultiLanguageProperty", AasTypes.AasSubmodelElements.MultiLanguageProperty],
173
    ["Operation", AasTypes.AasSubmodelElements.Operation],
174
    ["Property", AasTypes.AasSubmodelElements.Property],
175
    ["Range", AasTypes.AasSubmodelElements.Range],
176
    ["ReferenceElement", AasTypes.AasSubmodelElements.ReferenceElement],
177
    ["RelationshipElement", AasTypes.AasSubmodelElements.RelationshipElement],
178
    ["SubmodelElement", AasTypes.AasSubmodelElements.SubmodelElement],
179
    ["SubmodelElementList", AasTypes.AasSubmodelElements.SubmodelElementList],
180
    [
181
      "SubmodelElementCollection",
182
      AasTypes.AasSubmodelElements.SubmodelElementCollection
183
    ]
184
  ]
185
);
186

187
/**
188
 * Parse `text` as a string representation of {@link types!AasSubmodelElements}.
189
 *
190
 * @param text - string representation of {@link types!AasSubmodelElements}
191
 * @returns literal of {@link types!AasSubmodelElements}, if valid, and `null` otherwise
192
 */
193
export function aasSubmodelElementsFromString(
9✔
194
  text: string
195
): AasTypes.AasSubmodelElements | null {
196
  const result = AAS_SUBMODEL_ELEMENTS_FROM_STRING.get(text);
85✔
197
  return result !== undefined ? result : null;
85✔
198
}
199

200
const AAS_SUBMODEL_ELEMENTS_TO_STRING = new Map<AasTypes.AasSubmodelElements, string>([
9✔
201
  [
202
    AasTypes.AasSubmodelElements.AnnotatedRelationshipElement,
203
    "AnnotatedRelationshipElement"
204
  ],
205
  [AasTypes.AasSubmodelElements.BasicEventElement, "BasicEventElement"],
206
  [AasTypes.AasSubmodelElements.Blob, "Blob"],
207
  [AasTypes.AasSubmodelElements.Capability, "Capability"],
208
  [AasTypes.AasSubmodelElements.DataElement, "DataElement"],
209
  [AasTypes.AasSubmodelElements.Entity, "Entity"],
210
  [AasTypes.AasSubmodelElements.EventElement, "EventElement"],
211
  [AasTypes.AasSubmodelElements.File, "File"],
212
  [AasTypes.AasSubmodelElements.MultiLanguageProperty, "MultiLanguageProperty"],
213
  [AasTypes.AasSubmodelElements.Operation, "Operation"],
214
  [AasTypes.AasSubmodelElements.Property, "Property"],
215
  [AasTypes.AasSubmodelElements.Range, "Range"],
216
  [AasTypes.AasSubmodelElements.ReferenceElement, "ReferenceElement"],
217
  [AasTypes.AasSubmodelElements.RelationshipElement, "RelationshipElement"],
218
  [AasTypes.AasSubmodelElements.SubmodelElement, "SubmodelElement"],
219
  [AasTypes.AasSubmodelElements.SubmodelElementList, "SubmodelElementList"],
220
  [AasTypes.AasSubmodelElements.SubmodelElementCollection, "SubmodelElementCollection"]
221
]);
222

223
/**
224
 * Translate {@link types!AasSubmodelElements} to a string.
225
 *
226
 * @param value - to be stringified
227
 * @returns string representation of {@link types!AasSubmodelElements}, if `value` valid, and `null` otherwise
228
 */
229
export function aasSubmodelElementsToString(
9✔
230
  value: AasTypes.AasSubmodelElements
231
): string | null {
232
  const result = AAS_SUBMODEL_ELEMENTS_TO_STRING.get(value);
×
233
  return result !== undefined ? result : null;
×
234
}
235

236
/**
237
 * Translate {@link types!AasSubmodelElements} to a string.
238
 *
239
 * @param value - to be stringified
240
 * @returns string representation of {@link types!AasSubmodelElements}
241
 * @throws
242
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
243
 * if the `value` is invalid
244
 */
245
export function mustAasSubmodelElementsToString(
9✔
246
  value: AasTypes.AasSubmodelElements
247
): string {
248
  const result = AAS_SUBMODEL_ELEMENTS_TO_STRING.get(value);
30✔
249
  if (result === undefined) {
30!
250
    throw new Error(`Invalid literal of AasSubmodelElements: ${value}`);
×
251
  }
252
  return result;
30✔
253
}
254

255
const ENTITY_TYPE_FROM_STRING = new Map<string, AasTypes.EntityType>([
9✔
256
  ["CoManagedEntity", AasTypes.EntityType.CoManagedEntity],
257
  ["SelfManagedEntity", AasTypes.EntityType.SelfManagedEntity]
258
]);
259

260
/**
261
 * Parse `text` as a string representation of {@link types!EntityType}.
262
 *
263
 * @param text - string representation of {@link types!EntityType}
264
 * @returns literal of {@link types!EntityType}, if valid, and `null` otherwise
265
 */
266
export function entityTypeFromString(text: string): AasTypes.EntityType | null {
9✔
267
  const result = ENTITY_TYPE_FROM_STRING.get(text);
86✔
268
  return result !== undefined ? result : null;
86✔
269
}
270

271
const ENTITY_TYPE_TO_STRING = new Map<AasTypes.EntityType, string>([
9✔
272
  [AasTypes.EntityType.CoManagedEntity, "CoManagedEntity"],
273
  [AasTypes.EntityType.SelfManagedEntity, "SelfManagedEntity"]
274
]);
275

276
/**
277
 * Translate {@link types!EntityType} to a string.
278
 *
279
 * @param value - to be stringified
280
 * @returns string representation of {@link types!EntityType}, if `value` valid, and `null` otherwise
281
 */
282
export function entityTypeToString(value: AasTypes.EntityType): string | null {
9✔
283
  const result = ENTITY_TYPE_TO_STRING.get(value);
×
284
  return result !== undefined ? result : null;
×
285
}
286

287
/**
288
 * Translate {@link types!EntityType} to a string.
289
 *
290
 * @param value - to be stringified
291
 * @returns string representation of {@link types!EntityType}
292
 * @throws
293
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
294
 * if the `value` is invalid
295
 */
296
export function mustEntityTypeToString(value: AasTypes.EntityType): string {
9✔
297
  const result = ENTITY_TYPE_TO_STRING.get(value);
28✔
298
  if (result === undefined) {
28!
299
    throw new Error(`Invalid literal of EntityType: ${value}`);
×
300
  }
301
  return result;
28✔
302
}
303

304
const DIRECTION_FROM_STRING = new Map<string, AasTypes.Direction>([
9✔
305
  ["input", AasTypes.Direction.Input],
306
  ["output", AasTypes.Direction.Output]
307
]);
308

309
/**
310
 * Parse `text` as a string representation of {@link types!Direction}.
311
 *
312
 * @param text - string representation of {@link types!Direction}
313
 * @returns literal of {@link types!Direction}, if valid, and `null` otherwise
314
 */
315
export function directionFromString(text: string): AasTypes.Direction | null {
9✔
316
  const result = DIRECTION_FROM_STRING.get(text);
179✔
317
  return result !== undefined ? result : null;
179✔
318
}
319

320
const DIRECTION_TO_STRING = new Map<AasTypes.Direction, string>([
9✔
321
  [AasTypes.Direction.Input, "input"],
322
  [AasTypes.Direction.Output, "output"]
323
]);
324

325
/**
326
 * Translate {@link types!Direction} to a string.
327
 *
328
 * @param value - to be stringified
329
 * @returns string representation of {@link types!Direction}, if `value` valid, and `null` otherwise
330
 */
331
export function directionToString(value: AasTypes.Direction): string | null {
9✔
332
  const result = DIRECTION_TO_STRING.get(value);
×
333
  return result !== undefined ? result : null;
×
334
}
335

336
/**
337
 * Translate {@link types!Direction} to a string.
338
 *
339
 * @param value - to be stringified
340
 * @returns string representation of {@link types!Direction}
341
 * @throws
342
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
343
 * if the `value` is invalid
344
 */
345
export function mustDirectionToString(value: AasTypes.Direction): string {
9✔
346
  const result = DIRECTION_TO_STRING.get(value);
54✔
347
  if (result === undefined) {
54!
348
    throw new Error(`Invalid literal of Direction: ${value}`);
×
349
  }
350
  return result;
54✔
351
}
352

353
const STATE_OF_EVENT_FROM_STRING = new Map<string, AasTypes.StateOfEvent>([
9✔
354
  ["on", AasTypes.StateOfEvent.On],
355
  ["off", AasTypes.StateOfEvent.Off]
356
]);
357

358
/**
359
 * Parse `text` as a string representation of {@link types!StateOfEvent}.
360
 *
361
 * @param text - string representation of {@link types!StateOfEvent}
362
 * @returns literal of {@link types!StateOfEvent}, if valid, and `null` otherwise
363
 */
364
export function stateOfEventFromString(text: string): AasTypes.StateOfEvent | null {
9✔
365
  const result = STATE_OF_EVENT_FROM_STRING.get(text);
157✔
366
  return result !== undefined ? result : null;
157✔
367
}
368

369
const STATE_OF_EVENT_TO_STRING = new Map<AasTypes.StateOfEvent, string>([
9✔
370
  [AasTypes.StateOfEvent.On, "on"],
371
  [AasTypes.StateOfEvent.Off, "off"]
372
]);
373

374
/**
375
 * Translate {@link types!StateOfEvent} to a string.
376
 *
377
 * @param value - to be stringified
378
 * @returns string representation of {@link types!StateOfEvent}, if `value` valid, and `null` otherwise
379
 */
380
export function stateOfEventToString(value: AasTypes.StateOfEvent): string | null {
9✔
381
  const result = STATE_OF_EVENT_TO_STRING.get(value);
×
382
  return result !== undefined ? result : null;
×
383
}
384

385
/**
386
 * Translate {@link types!StateOfEvent} to a string.
387
 *
388
 * @param value - to be stringified
389
 * @returns string representation of {@link types!StateOfEvent}
390
 * @throws
391
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
392
 * if the `value` is invalid
393
 */
394
export function mustStateOfEventToString(value: AasTypes.StateOfEvent): string {
9✔
395
  const result = STATE_OF_EVENT_TO_STRING.get(value);
54✔
396
  if (result === undefined) {
54!
397
    throw new Error(`Invalid literal of StateOfEvent: ${value}`);
×
398
  }
399
  return result;
54✔
400
}
401

402
const REFERENCE_TYPES_FROM_STRING = new Map<string, AasTypes.ReferenceTypes>([
9✔
403
  ["GlobalReference", AasTypes.ReferenceTypes.GlobalReference],
404
  ["ModelReference", AasTypes.ReferenceTypes.ModelReference]
405
]);
406

407
/**
408
 * Parse `text` as a string representation of {@link types!ReferenceTypes}.
409
 *
410
 * @param text - string representation of {@link types!ReferenceTypes}
411
 * @returns literal of {@link types!ReferenceTypes}, if valid, and `null` otherwise
412
 */
413
export function referenceTypesFromString(text: string): AasTypes.ReferenceTypes | null {
9✔
414
  const result = REFERENCE_TYPES_FROM_STRING.get(text);
1,919✔
415
  return result !== undefined ? result : null;
1,919✔
416
}
417

418
const REFERENCE_TYPES_TO_STRING = new Map<AasTypes.ReferenceTypes, string>([
9✔
419
  [AasTypes.ReferenceTypes.GlobalReference, "GlobalReference"],
420
  [AasTypes.ReferenceTypes.ModelReference, "ModelReference"]
421
]);
422

423
/**
424
 * Translate {@link types!ReferenceTypes} to a string.
425
 *
426
 * @param value - to be stringified
427
 * @returns string representation of {@link types!ReferenceTypes}, if `value` valid, and `null` otherwise
428
 */
429
export function referenceTypesToString(value: AasTypes.ReferenceTypes): string | null {
9✔
430
  const result = REFERENCE_TYPES_TO_STRING.get(value);
×
431
  return result !== undefined ? result : null;
×
432
}
433

434
/**
435
 * Translate {@link types!ReferenceTypes} to a string.
436
 *
437
 * @param value - to be stringified
438
 * @returns string representation of {@link types!ReferenceTypes}
439
 * @throws
440
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
441
 * if the `value` is invalid
442
 */
443
export function mustReferenceTypesToString(value: AasTypes.ReferenceTypes): string {
9✔
444
  const result = REFERENCE_TYPES_TO_STRING.get(value);
450✔
445
  if (result === undefined) {
450!
446
    throw new Error(`Invalid literal of ReferenceTypes: ${value}`);
×
447
  }
448
  return result;
450✔
449
}
450

451
const KEY_TYPES_FROM_STRING = new Map<string, AasTypes.KeyTypes>([
9✔
452
  ["FragmentReference", AasTypes.KeyTypes.FragmentReference],
453
  ["GlobalReference", AasTypes.KeyTypes.GlobalReference],
454
  ["AnnotatedRelationshipElement", AasTypes.KeyTypes.AnnotatedRelationshipElement],
455
  ["AssetAdministrationShell", AasTypes.KeyTypes.AssetAdministrationShell],
456
  ["BasicEventElement", AasTypes.KeyTypes.BasicEventElement],
457
  ["Blob", AasTypes.KeyTypes.Blob],
458
  ["Capability", AasTypes.KeyTypes.Capability],
459
  ["ConceptDescription", AasTypes.KeyTypes.ConceptDescription],
460
  ["Identifiable", AasTypes.KeyTypes.Identifiable],
461
  ["DataElement", AasTypes.KeyTypes.DataElement],
462
  ["Entity", AasTypes.KeyTypes.Entity],
463
  ["EventElement", AasTypes.KeyTypes.EventElement],
464
  ["File", AasTypes.KeyTypes.File],
465
  ["MultiLanguageProperty", AasTypes.KeyTypes.MultiLanguageProperty],
466
  ["Operation", AasTypes.KeyTypes.Operation],
467
  ["Property", AasTypes.KeyTypes.Property],
468
  ["Range", AasTypes.KeyTypes.Range],
469
  ["ReferenceElement", AasTypes.KeyTypes.ReferenceElement],
470
  ["Referable", AasTypes.KeyTypes.Referable],
471
  ["RelationshipElement", AasTypes.KeyTypes.RelationshipElement],
472
  ["Submodel", AasTypes.KeyTypes.Submodel],
473
  ["SubmodelElement", AasTypes.KeyTypes.SubmodelElement],
474
  ["SubmodelElementList", AasTypes.KeyTypes.SubmodelElementList],
475
  ["SubmodelElementCollection", AasTypes.KeyTypes.SubmodelElementCollection]
476
]);
477

478
/**
479
 * Parse `text` as a string representation of {@link types!KeyTypes}.
480
 *
481
 * @param text - string representation of {@link types!KeyTypes}
482
 * @returns literal of {@link types!KeyTypes}, if valid, and `null` otherwise
483
 */
484
export function keyTypesFromString(text: string): AasTypes.KeyTypes | null {
9✔
485
  const result = KEY_TYPES_FROM_STRING.get(text);
2,207✔
486
  return result !== undefined ? result : null;
2,207✔
487
}
488

489
const KEY_TYPES_TO_STRING = new Map<AasTypes.KeyTypes, string>([
9✔
490
  [AasTypes.KeyTypes.FragmentReference, "FragmentReference"],
491
  [AasTypes.KeyTypes.GlobalReference, "GlobalReference"],
492
  [AasTypes.KeyTypes.AnnotatedRelationshipElement, "AnnotatedRelationshipElement"],
493
  [AasTypes.KeyTypes.AssetAdministrationShell, "AssetAdministrationShell"],
494
  [AasTypes.KeyTypes.BasicEventElement, "BasicEventElement"],
495
  [AasTypes.KeyTypes.Blob, "Blob"],
496
  [AasTypes.KeyTypes.Capability, "Capability"],
497
  [AasTypes.KeyTypes.ConceptDescription, "ConceptDescription"],
498
  [AasTypes.KeyTypes.Identifiable, "Identifiable"],
499
  [AasTypes.KeyTypes.DataElement, "DataElement"],
500
  [AasTypes.KeyTypes.Entity, "Entity"],
501
  [AasTypes.KeyTypes.EventElement, "EventElement"],
502
  [AasTypes.KeyTypes.File, "File"],
503
  [AasTypes.KeyTypes.MultiLanguageProperty, "MultiLanguageProperty"],
504
  [AasTypes.KeyTypes.Operation, "Operation"],
505
  [AasTypes.KeyTypes.Property, "Property"],
506
  [AasTypes.KeyTypes.Range, "Range"],
507
  [AasTypes.KeyTypes.ReferenceElement, "ReferenceElement"],
508
  [AasTypes.KeyTypes.Referable, "Referable"],
509
  [AasTypes.KeyTypes.RelationshipElement, "RelationshipElement"],
510
  [AasTypes.KeyTypes.Submodel, "Submodel"],
511
  [AasTypes.KeyTypes.SubmodelElement, "SubmodelElement"],
512
  [AasTypes.KeyTypes.SubmodelElementList, "SubmodelElementList"],
513
  [AasTypes.KeyTypes.SubmodelElementCollection, "SubmodelElementCollection"]
514
]);
515

516
/**
517
 * Translate {@link types!KeyTypes} to a string.
518
 *
519
 * @param value - to be stringified
520
 * @returns string representation of {@link types!KeyTypes}, if `value` valid, and `null` otherwise
521
 */
522
export function keyTypesToString(value: AasTypes.KeyTypes): string | null {
9✔
523
  const result = KEY_TYPES_TO_STRING.get(value);
×
524
  return result !== undefined ? result : null;
×
525
}
526

527
/**
528
 * Translate {@link types!KeyTypes} to a string.
529
 *
530
 * @param value - to be stringified
531
 * @returns string representation of {@link types!KeyTypes}
532
 * @throws
533
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
534
 * if the `value` is invalid
535
 */
536
export function mustKeyTypesToString(value: AasTypes.KeyTypes): string {
9✔
537
  const result = KEY_TYPES_TO_STRING.get(value);
535✔
538
  if (result === undefined) {
535!
539
    throw new Error(`Invalid literal of KeyTypes: ${value}`);
×
540
  }
541
  return result;
535✔
542
}
543

544
const DATA_TYPE_DEF_XSD_FROM_STRING = new Map<string, AasTypes.DataTypeDefXsd>([
9✔
545
  ["xs:anyURI", AasTypes.DataTypeDefXsd.AnyUri],
546
  ["xs:base64Binary", AasTypes.DataTypeDefXsd.Base64Binary],
547
  ["xs:boolean", AasTypes.DataTypeDefXsd.Boolean],
548
  ["xs:date", AasTypes.DataTypeDefXsd.Date],
549
  ["xs:dateTime", AasTypes.DataTypeDefXsd.DateTime],
550
  ["xs:dateTimeStamp", AasTypes.DataTypeDefXsd.DateTimeStamp],
551
  ["xs:decimal", AasTypes.DataTypeDefXsd.Decimal],
552
  ["xs:double", AasTypes.DataTypeDefXsd.Double],
553
  ["xs:duration", AasTypes.DataTypeDefXsd.Duration],
554
  ["xs:float", AasTypes.DataTypeDefXsd.Float],
555
  ["xs:gDay", AasTypes.DataTypeDefXsd.GDay],
556
  ["xs:gMonth", AasTypes.DataTypeDefXsd.GMonth],
557
  ["xs:gMonthDay", AasTypes.DataTypeDefXsd.GMonthDay],
558
  ["xs:gYear", AasTypes.DataTypeDefXsd.GYear],
559
  ["xs:gYearMonth", AasTypes.DataTypeDefXsd.GYearMonth],
560
  ["xs:hexBinary", AasTypes.DataTypeDefXsd.HexBinary],
561
  ["xs:string", AasTypes.DataTypeDefXsd.String],
562
  ["xs:time", AasTypes.DataTypeDefXsd.Time],
563
  ["xs:dayTimeDuration", AasTypes.DataTypeDefXsd.DayTimeDuration],
564
  ["xs:yearMonthDuration", AasTypes.DataTypeDefXsd.YearMonthDuration],
565
  ["xs:integer", AasTypes.DataTypeDefXsd.Integer],
566
  ["xs:long", AasTypes.DataTypeDefXsd.Long],
567
  ["xs:int", AasTypes.DataTypeDefXsd.Int],
568
  ["xs:short", AasTypes.DataTypeDefXsd.Short],
569
  ["xs:byte", AasTypes.DataTypeDefXsd.Byte],
570
  ["xs:nonNegativeInteger", AasTypes.DataTypeDefXsd.NonNegativeInteger],
571
  ["xs:positiveInteger", AasTypes.DataTypeDefXsd.PositiveInteger],
572
  ["xs:unsignedLong", AasTypes.DataTypeDefXsd.UnsignedLong],
573
  ["xs:unsignedInt", AasTypes.DataTypeDefXsd.UnsignedInt],
574
  ["xs:unsignedShort", AasTypes.DataTypeDefXsd.UnsignedShort],
575
  ["xs:unsignedByte", AasTypes.DataTypeDefXsd.UnsignedByte],
576
  ["xs:nonPositiveInteger", AasTypes.DataTypeDefXsd.NonPositiveInteger],
577
  ["xs:negativeInteger", AasTypes.DataTypeDefXsd.NegativeInteger]
578
]);
579

580
/**
581
 * Parse `text` as a string representation of {@link types!DataTypeDefXsd}.
582
 *
583
 * @param text - string representation of {@link types!DataTypeDefXsd}
584
 * @returns literal of {@link types!DataTypeDefXsd}, if valid, and `null` otherwise
585
 */
586
export function dataTypeDefXsdFromString(text: string): AasTypes.DataTypeDefXsd | null {
9✔
587
  const result = DATA_TYPE_DEF_XSD_FROM_STRING.get(text);
4,183✔
588
  return result !== undefined ? result : null;
4,183✔
589
}
590

591
const DATA_TYPE_DEF_XSD_TO_STRING = new Map<AasTypes.DataTypeDefXsd, string>([
9✔
592
  [AasTypes.DataTypeDefXsd.AnyUri, "xs:anyURI"],
593
  [AasTypes.DataTypeDefXsd.Base64Binary, "xs:base64Binary"],
594
  [AasTypes.DataTypeDefXsd.Boolean, "xs:boolean"],
595
  [AasTypes.DataTypeDefXsd.Date, "xs:date"],
596
  [AasTypes.DataTypeDefXsd.DateTime, "xs:dateTime"],
597
  [AasTypes.DataTypeDefXsd.DateTimeStamp, "xs:dateTimeStamp"],
598
  [AasTypes.DataTypeDefXsd.Decimal, "xs:decimal"],
599
  [AasTypes.DataTypeDefXsd.Double, "xs:double"],
600
  [AasTypes.DataTypeDefXsd.Duration, "xs:duration"],
601
  [AasTypes.DataTypeDefXsd.Float, "xs:float"],
602
  [AasTypes.DataTypeDefXsd.GDay, "xs:gDay"],
603
  [AasTypes.DataTypeDefXsd.GMonth, "xs:gMonth"],
604
  [AasTypes.DataTypeDefXsd.GMonthDay, "xs:gMonthDay"],
605
  [AasTypes.DataTypeDefXsd.GYear, "xs:gYear"],
606
  [AasTypes.DataTypeDefXsd.GYearMonth, "xs:gYearMonth"],
607
  [AasTypes.DataTypeDefXsd.HexBinary, "xs:hexBinary"],
608
  [AasTypes.DataTypeDefXsd.String, "xs:string"],
609
  [AasTypes.DataTypeDefXsd.Time, "xs:time"],
610
  [AasTypes.DataTypeDefXsd.DayTimeDuration, "xs:dayTimeDuration"],
611
  [AasTypes.DataTypeDefXsd.YearMonthDuration, "xs:yearMonthDuration"],
612
  [AasTypes.DataTypeDefXsd.Integer, "xs:integer"],
613
  [AasTypes.DataTypeDefXsd.Long, "xs:long"],
614
  [AasTypes.DataTypeDefXsd.Int, "xs:int"],
615
  [AasTypes.DataTypeDefXsd.Short, "xs:short"],
616
  [AasTypes.DataTypeDefXsd.Byte, "xs:byte"],
617
  [AasTypes.DataTypeDefXsd.NonNegativeInteger, "xs:nonNegativeInteger"],
618
  [AasTypes.DataTypeDefXsd.PositiveInteger, "xs:positiveInteger"],
619
  [AasTypes.DataTypeDefXsd.UnsignedLong, "xs:unsignedLong"],
620
  [AasTypes.DataTypeDefXsd.UnsignedInt, "xs:unsignedInt"],
621
  [AasTypes.DataTypeDefXsd.UnsignedShort, "xs:unsignedShort"],
622
  [AasTypes.DataTypeDefXsd.UnsignedByte, "xs:unsignedByte"],
623
  [AasTypes.DataTypeDefXsd.NonPositiveInteger, "xs:nonPositiveInteger"],
624
  [AasTypes.DataTypeDefXsd.NegativeInteger, "xs:negativeInteger"]
625
]);
626

627
/**
628
 * Translate {@link types!DataTypeDefXsd} to a string.
629
 *
630
 * @param value - to be stringified
631
 * @returns string representation of {@link types!DataTypeDefXsd}, if `value` valid, and `null` otherwise
632
 */
633
export function dataTypeDefXsdToString(value: AasTypes.DataTypeDefXsd): string | null {
9✔
634
  const result = DATA_TYPE_DEF_XSD_TO_STRING.get(value);
×
635
  return result !== undefined ? result : null;
×
636
}
637

638
/**
639
 * Translate {@link types!DataTypeDefXsd} to a string.
640
 *
641
 * @param value - to be stringified
642
 * @returns string representation of {@link types!DataTypeDefXsd}
643
 * @throws
644
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
645
 * if the `value` is invalid
646
 */
647
export function mustDataTypeDefXsdToString(value: AasTypes.DataTypeDefXsd): string {
9✔
648
  const result = DATA_TYPE_DEF_XSD_TO_STRING.get(value);
2,429✔
649
  if (result === undefined) {
2,429!
650
    throw new Error(`Invalid literal of DataTypeDefXsd: ${value}`);
×
651
  }
652
  return result;
2,429✔
653
}
654

655
const DATA_TYPE_IEC_61360_FROM_STRING = new Map<string, AasTypes.DataTypeIec61360>([
9✔
656
  ["DATE", AasTypes.DataTypeIec61360.Date],
657
  ["STRING", AasTypes.DataTypeIec61360.String],
658
  ["STRING_TRANSLATABLE", AasTypes.DataTypeIec61360.StringTranslatable],
659
  ["INTEGER_MEASURE", AasTypes.DataTypeIec61360.IntegerMeasure],
660
  ["INTEGER_COUNT", AasTypes.DataTypeIec61360.IntegerCount],
661
  ["INTEGER_CURRENCY", AasTypes.DataTypeIec61360.IntegerCurrency],
662
  ["REAL_MEASURE", AasTypes.DataTypeIec61360.RealMeasure],
663
  ["REAL_COUNT", AasTypes.DataTypeIec61360.RealCount],
664
  ["REAL_CURRENCY", AasTypes.DataTypeIec61360.RealCurrency],
665
  ["BOOLEAN", AasTypes.DataTypeIec61360.Boolean],
666
  ["IRI", AasTypes.DataTypeIec61360.Iri],
667
  ["IRDI", AasTypes.DataTypeIec61360.Irdi],
668
  ["RATIONAL", AasTypes.DataTypeIec61360.Rational],
669
  ["RATIONAL_MEASURE", AasTypes.DataTypeIec61360.RationalMeasure],
670
  ["TIME", AasTypes.DataTypeIec61360.Time],
671
  ["TIMESTAMP", AasTypes.DataTypeIec61360.Timestamp],
672
  ["FILE", AasTypes.DataTypeIec61360.File],
673
  ["HTML", AasTypes.DataTypeIec61360.Html],
674
  ["BLOB", AasTypes.DataTypeIec61360.Blob]
675
]);
676

677
/**
678
 * Parse `text` as a string representation of {@link types!DataTypeIec61360}.
679
 *
680
 * @param text - string representation of {@link types!DataTypeIec61360}
681
 * @returns literal of {@link types!DataTypeIec61360}, if valid, and `null` otherwise
682
 */
683
export function dataTypeIec61360FromString(
9✔
684
  text: string
685
): AasTypes.DataTypeIec61360 | null {
686
  const result = DATA_TYPE_IEC_61360_FROM_STRING.get(text);
23✔
687
  return result !== undefined ? result : null;
23✔
688
}
689

690
const DATA_TYPE_IEC_61360_TO_STRING = new Map<AasTypes.DataTypeIec61360, string>([
9✔
691
  [AasTypes.DataTypeIec61360.Date, "DATE"],
692
  [AasTypes.DataTypeIec61360.String, "STRING"],
693
  [AasTypes.DataTypeIec61360.StringTranslatable, "STRING_TRANSLATABLE"],
694
  [AasTypes.DataTypeIec61360.IntegerMeasure, "INTEGER_MEASURE"],
695
  [AasTypes.DataTypeIec61360.IntegerCount, "INTEGER_COUNT"],
696
  [AasTypes.DataTypeIec61360.IntegerCurrency, "INTEGER_CURRENCY"],
697
  [AasTypes.DataTypeIec61360.RealMeasure, "REAL_MEASURE"],
698
  [AasTypes.DataTypeIec61360.RealCount, "REAL_COUNT"],
699
  [AasTypes.DataTypeIec61360.RealCurrency, "REAL_CURRENCY"],
700
  [AasTypes.DataTypeIec61360.Boolean, "BOOLEAN"],
701
  [AasTypes.DataTypeIec61360.Iri, "IRI"],
702
  [AasTypes.DataTypeIec61360.Irdi, "IRDI"],
703
  [AasTypes.DataTypeIec61360.Rational, "RATIONAL"],
704
  [AasTypes.DataTypeIec61360.RationalMeasure, "RATIONAL_MEASURE"],
705
  [AasTypes.DataTypeIec61360.Time, "TIME"],
706
  [AasTypes.DataTypeIec61360.Timestamp, "TIMESTAMP"],
707
  [AasTypes.DataTypeIec61360.File, "FILE"],
708
  [AasTypes.DataTypeIec61360.Html, "HTML"],
709
  [AasTypes.DataTypeIec61360.Blob, "BLOB"]
710
]);
711

712
/**
713
 * Translate {@link types!DataTypeIec61360} to a string.
714
 *
715
 * @param value - to be stringified
716
 * @returns string representation of {@link types!DataTypeIec61360}, if `value` valid, and `null` otherwise
717
 */
718
export function dataTypeIec61360ToString(
9✔
719
  value: AasTypes.DataTypeIec61360
720
): string | null {
721
  const result = DATA_TYPE_IEC_61360_TO_STRING.get(value);
×
722
  return result !== undefined ? result : null;
×
723
}
724

725
/**
726
 * Translate {@link types!DataTypeIec61360} to a string.
727
 *
728
 * @param value - to be stringified
729
 * @returns string representation of {@link types!DataTypeIec61360}
730
 * @throws
731
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
732
 * if the `value` is invalid
733
 */
734
export function mustDataTypeIec61360ToString(value: AasTypes.DataTypeIec61360): string {
9✔
735
  const result = DATA_TYPE_IEC_61360_TO_STRING.get(value);
3✔
736
  if (result === undefined) {
3!
737
    throw new Error(`Invalid literal of DataTypeIec61360: ${value}`);
×
738
  }
739
  return result;
3✔
740
}
741

742
const LEVEL_TYPE_FROM_STRING = new Map<string, AasTypes.LevelType>([
9✔
743
  ["Min", AasTypes.LevelType.Min],
744
  ["Max", AasTypes.LevelType.Max],
745
  ["Nom", AasTypes.LevelType.Nom],
746
  ["Typ", AasTypes.LevelType.Typ]
747
]);
748

749
/**
750
 * Parse `text` as a string representation of {@link types!LevelType}.
751
 *
752
 * @param text - string representation of {@link types!LevelType}
753
 * @returns literal of {@link types!LevelType}, if valid, and `null` otherwise
754
 */
755
export function levelTypeFromString(text: string): AasTypes.LevelType | null {
9✔
756
  const result = LEVEL_TYPE_FROM_STRING.get(text);
21✔
757
  return result !== undefined ? result : null;
21✔
758
}
759

760
const LEVEL_TYPE_TO_STRING = new Map<AasTypes.LevelType, string>([
9✔
761
  [AasTypes.LevelType.Min, "Min"],
762
  [AasTypes.LevelType.Max, "Max"],
763
  [AasTypes.LevelType.Nom, "Nom"],
764
  [AasTypes.LevelType.Typ, "Typ"]
765
]);
766

767
/**
768
 * Translate {@link types!LevelType} to a string.
769
 *
770
 * @param value - to be stringified
771
 * @returns string representation of {@link types!LevelType}, if `value` valid, and `null` otherwise
772
 */
773
export function levelTypeToString(value: AasTypes.LevelType): string | null {
9✔
774
  const result = LEVEL_TYPE_TO_STRING.get(value);
×
775
  return result !== undefined ? result : null;
×
776
}
777

778
/**
779
 * Translate {@link types!LevelType} to a string.
780
 *
781
 * @param value - to be stringified
782
 * @returns string representation of {@link types!LevelType}
783
 * @throws
784
 * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}
785
 * if the `value` is invalid
786
 */
787
export function mustLevelTypeToString(value: AasTypes.LevelType): string {
9✔
788
  const result = LEVEL_TYPE_TO_STRING.get(value);
3✔
789
  if (result === undefined) {
3!
790
    throw new Error(`Invalid literal of LevelType: ${value}`);
×
791
  }
792
  return result;
3✔
793
}
794

795
// This code has been automatically generated by aas-core-codegen.
796
// Do NOT edit or append.
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc