basyx-typescript-sdk 0.2.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/bundle/index.js +17522 -841
- package/bundle/index.js.map +1 -1
- package/dist/clients/AasDiscoveryClient.d.ts +67 -0
- package/dist/clients/AasDiscoveryClient.js +115 -0
- package/dist/clients/AasRegistryClient.d.ts +163 -0
- package/dist/clients/AasRegistryClient.js +287 -0
- package/dist/clients/AasRepositoryClient.d.ts +790 -103
- package/dist/clients/AasRepositoryClient.js +1323 -211
- package/dist/clients/AasxFileClient.d.ts +81 -0
- package/dist/clients/AasxFileClient.js +148 -0
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +83 -0
- package/dist/clients/ConceptDescriptionRepositoryClient.js +143 -0
- package/dist/clients/SubmodelRegistryClient.d.ts +77 -0
- package/dist/clients/SubmodelRegistryClient.js +138 -0
- package/dist/clients/SubmodelRepositoryClient.d.ts +354 -0
- package/dist/clients/SubmodelRepositoryClient.js +585 -0
- package/dist/clients/index.d.ts +6 -0
- package/dist/clients/index.js +6 -0
- package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.d.ts +80 -0
- package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.js +156 -0
- package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/AasDiscoveryService/apis/index.d.ts +2 -0
- package/dist/generated/AasDiscoveryService/apis/index.js +4 -0
- package/dist/generated/AasDiscoveryService/index.d.ts +3 -0
- package/dist/generated/AasDiscoveryService/index.js +5 -0
- package/dist/generated/AasDiscoveryService/models/index.d.ts +297 -0
- package/dist/generated/AasDiscoveryService/models/index.js +48 -0
- package/dist/generated/AasDiscoveryService/runtime.d.ts +181 -0
- package/dist/generated/AasDiscoveryService/runtime.js +326 -0
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +139 -0
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +312 -0
- package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/AasRegistryService/apis/index.d.ts +2 -0
- package/dist/generated/AasRegistryService/apis/index.js +4 -0
- package/dist/generated/AasRegistryService/index.d.ts +3 -0
- package/dist/generated/AasRegistryService/index.js +5 -0
- package/dist/generated/AasRegistryService/models/index.d.ts +1070 -0
- package/dist/generated/AasRegistryService/models/index.js +151 -0
- package/dist/generated/AasRegistryService/runtime.d.ts +181 -0
- package/dist/generated/AasRegistryService/runtime.js +326 -0
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +870 -0
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1842 -0
- package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
- package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +49 -0
- package/dist/generated/AasRepositoryService/apis/index.d.ts +3 -0
- package/dist/generated/AasRepositoryService/apis/index.js +5 -0
- package/dist/generated/AasRepositoryService/index.d.ts +3 -0
- package/dist/generated/AasRepositoryService/index.js +5 -0
- package/dist/generated/AasRepositoryService/models/index.d.ts +4585 -0
- package/dist/generated/AasRepositoryService/models/index.js +221 -0
- package/dist/generated/AasRepositoryService/runtime.d.ts +181 -0
- package/dist/generated/AasRepositoryService/runtime.js +326 -0
- package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +78 -0
- package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +184 -0
- package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
- package/dist/generated/AasxFileService/apis/index.js +3 -0
- package/dist/generated/AasxFileService/index.d.ts +3 -0
- package/dist/generated/AasxFileService/index.js +5 -0
- package/dist/generated/AasxFileService/models/index.d.ts +80 -0
- package/dist/generated/AasxFileService/models/index.js +10 -0
- package/dist/generated/AasxFileService/runtime.d.ts +181 -0
- package/dist/generated/AasxFileService/runtime.js +326 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +78 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +164 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.js +49 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/index.d.ts +3 -0
- package/dist/generated/ConceptDescriptionRepositoryService/apis/index.js +5 -0
- package/dist/generated/ConceptDescriptionRepositoryService/index.d.ts +3 -0
- package/dist/generated/ConceptDescriptionRepositoryService/index.js +5 -0
- package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2869 -0
- package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +209 -0
- package/dist/generated/ConceptDescriptionRepositoryService/runtime.d.ts +181 -0
- package/dist/generated/ConceptDescriptionRepositoryService/runtime.js +326 -0
- package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +75 -0
- package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +155 -0
- package/dist/generated/SubmodelRegistryService/apis/index.d.ts +2 -0
- package/dist/generated/SubmodelRegistryService/apis/index.js +4 -0
- package/dist/generated/SubmodelRegistryService/index.d.ts +3 -0
- package/dist/generated/SubmodelRegistryService/index.js +5 -0
- package/dist/generated/SubmodelRegistryService/models/index.d.ts +924 -0
- package/dist/generated/SubmodelRegistryService/models/index.js +141 -0
- package/dist/generated/SubmodelRegistryService/runtime.d.ts +181 -0
- package/dist/generated/SubmodelRegistryService/runtime.js +326 -0
- package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
- package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.js +49 -0
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +802 -0
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +1572 -0
- package/dist/generated/SubmodelRepositoryService/apis/index.d.ts +3 -0
- package/dist/generated/SubmodelRepositoryService/apis/index.js +5 -0
- package/dist/generated/SubmodelRepositoryService/index.d.ts +3 -0
- package/dist/generated/SubmodelRepositoryService/index.js +5 -0
- package/dist/generated/SubmodelRepositoryService/models/index.d.ts +4623 -0
- package/dist/generated/SubmodelRepositoryService/models/index.js +221 -0
- package/dist/generated/SubmodelRepositoryService/runtime.d.ts +181 -0
- package/dist/generated/SubmodelRepositoryService/runtime.js +326 -0
- package/dist/generated/index.d.ts +8 -2
- package/dist/generated/index.js +8 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/apiConfig.d.ts +2 -0
- package/dist/lib/apiConfig.js +41 -0
- package/dist/lib/base64Url.js +4 -0
- package/dist/lib/convertAasDescriptorTypes.d.ts +34 -0
- package/dist/lib/convertAasDescriptorTypes.js +76 -0
- package/dist/lib/convertAasDiscoveryTypes.d.ts +18 -0
- package/dist/lib/convertAasDiscoveryTypes.js +39 -0
- package/dist/lib/convertAasTypes.d.ts +7 -7
- package/dist/lib/convertAasTypes.js +5 -0
- package/dist/lib/convertConceptDescriptionTypes.d.ts +18 -0
- package/dist/lib/convertConceptDescriptionTypes.js +39 -0
- package/dist/lib/convertSubmodelTypes.d.ts +34 -0
- package/dist/lib/convertSubmodelTypes.js +69 -0
- package/dist/lib/descriptorJsonization.d.ts +12 -0
- package/dist/lib/descriptorJsonization.js +172 -0
- package/dist/lib/errorHandler.d.ts +9 -0
- package/dist/lib/errorHandler.js +113 -0
- package/dist/models/Descriptors.d.ts +51 -0
- package/dist/models/Descriptors.js +56 -0
- package/dist/models/index.d.ts +0 -1
- package/dist/models/index.js +0 -1
- package/dist/utils/DescriptorUtils.d.ts +9 -0
- package/dist/utils/DescriptorUtils.js +37 -0
- package/dist/utils/KeyTypesUtil.d.ts +24 -0
- package/dist/utils/KeyTypesUtil.js +55 -0
- package/dist/utils/MultiLanguagePropertyUtils.d.ts +24 -0
- package/dist/utils/MultiLanguagePropertyUtils.js +46 -0
- package/dist/utils/ReferableUtils.d.ts +69 -0
- package/dist/utils/ReferableUtils.js +220 -0
- package/dist/utils/ReferenceUtil.d.ts +9 -0
- package/dist/utils/ReferenceUtil.js +22 -0
- package/dist/utils/SemanticIdUtils.d.ts +119 -0
- package/dist/utils/SemanticIdUtils.js +363 -0
- package/package.json +14 -11
- package/dist/generated/schemas.gen.d.ts +0 -2357
- package/dist/generated/schemas.gen.js +0 -2789
- package/dist/generated/sdk.gen.d.ts +0 -822
- package/dist/generated/sdk.gen.js +0 -2225
- package/dist/generated/types.gen.d.ts +0 -10829
- package/dist/generated/types.gen.js +0 -2
- package/dist/lib/createAasRepoClient.d.ts +0 -9
- package/dist/lib/createAasRepoClient.js +0 -15
- package/dist/models/aas-repository.d.ts +0 -65
- package/dist/models/aas-repository.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { KeyTypes } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* @constant {Array<Object>} keyTypes
|
|
4
|
+
* @description Enumeration of Key Types as specified in IDTA 01001-3-0-1, page 82.
|
|
5
|
+
* Each key type has a name and an abbreviation according to different IDTA SMT specifications (see appendix).
|
|
6
|
+
*
|
|
7
|
+
* @property {KeyTypes} type - The enum value of the key type.
|
|
8
|
+
* @property {string} abbreviation - The abbreviation of the key type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Example of a key type
|
|
12
|
+
* const aasKeyType = keyTypes[1]; // { type: KeyTypes.AssetAdministrationShell, abbreviation: 'AAS' }
|
|
13
|
+
*/
|
|
14
|
+
export declare const keyTypes: {
|
|
15
|
+
type: KeyTypes;
|
|
16
|
+
abbreviation: string;
|
|
17
|
+
}[];
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the abbreviation for a given Key Type.
|
|
20
|
+
*
|
|
21
|
+
* @param {KeyTypes} keyType - The KeyTypes enum value to look up.
|
|
22
|
+
* @returns {string} The abbreviation for the specified key type, or an empty string if not found or if the input is invalid.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getKeyTypeAbbreviation(keyType: KeyTypes): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { KeyTypes } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* @constant {Array<Object>} keyTypes
|
|
4
|
+
* @description Enumeration of Key Types as specified in IDTA 01001-3-0-1, page 82.
|
|
5
|
+
* Each key type has a name and an abbreviation according to different IDTA SMT specifications (see appendix).
|
|
6
|
+
*
|
|
7
|
+
* @property {KeyTypes} type - The enum value of the key type.
|
|
8
|
+
* @property {string} abbreviation - The abbreviation of the key type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Example of a key type
|
|
12
|
+
* const aasKeyType = keyTypes[1]; // { type: KeyTypes.AssetAdministrationShell, abbreviation: 'AAS' }
|
|
13
|
+
*/
|
|
14
|
+
export const keyTypes = [
|
|
15
|
+
{ type: KeyTypes.AnnotatedRelationshipElement, abbreviation: 'RelA' },
|
|
16
|
+
{ type: KeyTypes.AssetAdministrationShell, abbreviation: 'AAS' },
|
|
17
|
+
{ type: KeyTypes.BasicEventElement, abbreviation: '' },
|
|
18
|
+
{ type: KeyTypes.Blob, abbreviation: 'Blob' },
|
|
19
|
+
{ type: KeyTypes.Capability, abbreviation: 'Cap' },
|
|
20
|
+
{ type: KeyTypes.ConceptDescription, abbreviation: 'CD' },
|
|
21
|
+
{ type: KeyTypes.DataElement, abbreviation: '' },
|
|
22
|
+
{ type: KeyTypes.Entity, abbreviation: 'Ent' },
|
|
23
|
+
{ type: KeyTypes.EventElement, abbreviation: 'Evt' },
|
|
24
|
+
{ type: KeyTypes.File, abbreviation: 'File' },
|
|
25
|
+
{ type: KeyTypes.FragmentReference, abbreviation: '' },
|
|
26
|
+
{ type: KeyTypes.GlobalReference, abbreviation: 'GlobalRef' },
|
|
27
|
+
{ type: KeyTypes.Identifiable, abbreviation: '' },
|
|
28
|
+
{ type: KeyTypes.MultiLanguageProperty, abbreviation: 'MLP' },
|
|
29
|
+
{ type: KeyTypes.Operation, abbreviation: 'Opr' },
|
|
30
|
+
{ type: KeyTypes.Property, abbreviation: 'Prop' },
|
|
31
|
+
{ type: KeyTypes.Range, abbreviation: 'Range' },
|
|
32
|
+
{ type: KeyTypes.Referable, abbreviation: '' },
|
|
33
|
+
{ type: KeyTypes.ReferenceElement, abbreviation: 'Ref' },
|
|
34
|
+
{ type: KeyTypes.RelationshipElement, abbreviation: 'Rel' },
|
|
35
|
+
{ type: KeyTypes.Submodel, abbreviation: 'SM' },
|
|
36
|
+
{ type: KeyTypes.SubmodelElement, abbreviation: 'SME' },
|
|
37
|
+
{ type: KeyTypes.SubmodelElementCollection, abbreviation: 'SMC' },
|
|
38
|
+
{ type: KeyTypes.SubmodelElementList, abbreviation: 'SML' },
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the abbreviation for a given Key Type.
|
|
42
|
+
*
|
|
43
|
+
* @param {KeyTypes} keyType - The KeyTypes enum value to look up.
|
|
44
|
+
* @returns {string} The abbreviation for the specified key type, or an empty string if not found or if the input is invalid.
|
|
45
|
+
*/
|
|
46
|
+
export function getKeyTypeAbbreviation(keyType) {
|
|
47
|
+
const failResponse = '';
|
|
48
|
+
//if (!keyTypeName || keyTypeName.trim() === '') return failResponse;
|
|
49
|
+
if (keyType == null || typeof keyType !== 'number')
|
|
50
|
+
return failResponse;
|
|
51
|
+
const foundKeyType = keyTypes.find((kt) => kt.type === keyType);
|
|
52
|
+
if (foundKeyType && foundKeyType?.abbreviation && foundKeyType.abbreviation.trim() !== '')
|
|
53
|
+
return foundKeyType.abbreviation;
|
|
54
|
+
return failResponse;
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MultiLanguageProperty } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the given multi-language property object has a non-empty value.
|
|
4
|
+
*
|
|
5
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object to check.
|
|
6
|
+
* @returns {boolean} True if the multiLanguageProperty has a non-empty value, otherwise false.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hasValue(multiLanguageProperty: MultiLanguageProperty): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the display value from a multi-language property, defaulting to the specified language.
|
|
11
|
+
*
|
|
12
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object.
|
|
13
|
+
* @param {string} [language='en'] - The language code to look for in the multi-language property values (default is 'en').
|
|
14
|
+
* @param {string} [defaultValueToDisplay=''] - The default value to return if no appropriate value is found.
|
|
15
|
+
* @returns {string} The text value in the specified language, or the default value if not found.
|
|
16
|
+
*/
|
|
17
|
+
export declare function valueToDisplay(multiLanguageProperty: MultiLanguageProperty, language?: string, defaultValueToDisplay?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the first non-empty text string from a multi-language property.
|
|
20
|
+
*
|
|
21
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object.
|
|
22
|
+
* @returns {string} The first non-empty text string or an empty string if none found.
|
|
23
|
+
*/
|
|
24
|
+
export declare function firstLangStringSetText(multiLanguageProperty: MultiLanguageProperty): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { isMultiLanguageProperty } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the given multi-language property object has a non-empty value.
|
|
4
|
+
*
|
|
5
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object to check.
|
|
6
|
+
* @returns {boolean} True if the multiLanguageProperty has a non-empty value, otherwise false.
|
|
7
|
+
*/
|
|
8
|
+
export function hasValue(multiLanguageProperty) {
|
|
9
|
+
if (!isMultiLanguageProperty(multiLanguageProperty) || !multiLanguageProperty?.value?.length) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return multiLanguageProperty.value.some((langStringSet) => langStringSet?.text?.trim() !== '');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves the display value from a multi-language property, defaulting to the specified language.
|
|
16
|
+
*
|
|
17
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object.
|
|
18
|
+
* @param {string} [language='en'] - The language code to look for in the multi-language property values (default is 'en').
|
|
19
|
+
* @param {string} [defaultValueToDisplay=''] - The default value to return if no appropriate value is found.
|
|
20
|
+
* @returns {string} The text value in the specified language, or the default value if not found.
|
|
21
|
+
*/
|
|
22
|
+
export function valueToDisplay(multiLanguageProperty, language = 'en', defaultValueToDisplay = '') {
|
|
23
|
+
if (isMultiLanguageProperty(multiLanguageProperty) && hasValue(multiLanguageProperty)) {
|
|
24
|
+
const langStringSet = multiLanguageProperty.value?.find((value) => value?.language === language);
|
|
25
|
+
if (langStringSet && langStringSet?.text && langStringSet.text.trim() !== '') {
|
|
26
|
+
return langStringSet.text;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return defaultValueToDisplay;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the first non-empty text string from a multi-language property.
|
|
33
|
+
*
|
|
34
|
+
* @param {MultiLanguageProperty} multiLanguageProperty - The multi-language property object.
|
|
35
|
+
* @returns {string} The first non-empty text string or an empty string if none found.
|
|
36
|
+
*/
|
|
37
|
+
export function firstLangStringSetText(multiLanguageProperty) {
|
|
38
|
+
if (isMultiLanguageProperty(multiLanguageProperty) && hasValue(multiLanguageProperty)) {
|
|
39
|
+
for (const langString of multiLanguageProperty.value || []) {
|
|
40
|
+
if (langString?.text?.trim()) {
|
|
41
|
+
return langString.text.trim();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { IReferable, ISubmodelElement, Submodel } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the display name from a Referable object based on the specified language.
|
|
4
|
+
*
|
|
5
|
+
* The function follows these steps to determine the display name:
|
|
6
|
+
* 1. If a `displayName` entry with the specified language is found, it returns its text.
|
|
7
|
+
* 2. If `defaultNameToDisplay` is provided and not an empty string, it returns this value.
|
|
8
|
+
* 3. If `idShort` is available and not an empty string, it returns `idShort`.
|
|
9
|
+
* 4. If `id` is available and not an empty string, it returns `id`.
|
|
10
|
+
* 5. If none of the above conditions are met, it returns an empty string.
|
|
11
|
+
*
|
|
12
|
+
* @param {IReferable} referable - The Referable object to extract the display name from.
|
|
13
|
+
* @param {string} [language='en'] - The language code for the desired display name text. Defaults to 'en'.
|
|
14
|
+
* @param {string} [defaultNameToDisplay=''] - The default name to return if no display name is found. Defaults to an empty string.
|
|
15
|
+
* @returns {string} The determined display name or an appropriate fallback value.
|
|
16
|
+
*/
|
|
17
|
+
export declare function nameToDisplay(referable: IReferable, language?: string, defaultNameToDisplay?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts the description from a Referable object based on the specified language.
|
|
20
|
+
* If no suitable description is found, it returns a default description.
|
|
21
|
+
*
|
|
22
|
+
* The function checks if the Referable object has a non-empty `description` array,
|
|
23
|
+
* and then it attempts to find a description in the specified language (default is English).
|
|
24
|
+
*
|
|
25
|
+
* @param {IReferable} referable - The Referable object containing descriptions.
|
|
26
|
+
* @param {string} [language='en'] - The language code indicating the desired description language.
|
|
27
|
+
* @param {string} [defaultDescriptionToDisplay=''] - The default description to return if no matching description is found.
|
|
28
|
+
* @returns {string} The text of the found description in the specified language or the default description if not found.
|
|
29
|
+
*/
|
|
30
|
+
export declare function descriptionToDisplay(referable: IReferable, language?: string, defaultDescriptionToDisplay?: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the `idShort` of a Referable object matches the given `idShort`.
|
|
33
|
+
* The comparison can be performed in two modes:
|
|
34
|
+
* - **startsWith**: checks if the `idShort` of the Referable object starts with the given `idShort`.
|
|
35
|
+
* - **strict**: indicates whether the comparison should consider case sensitivity.
|
|
36
|
+
*
|
|
37
|
+
* @param {IReferable} referable - The Referable object containing the `idShort` to check.
|
|
38
|
+
* @param {string} idShort - The `idShort` string to compare against the Referable's `idShort`.
|
|
39
|
+
* @param {boolean} [startsWith=false] - If true, checks if the Referable's `idShort` starts with the given `idShort`.
|
|
40
|
+
* @param {boolean} [strict=false] - If true, the check will be case-sensitive.
|
|
41
|
+
* @returns {boolean} Returns true if a matching `idShort` is found, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export declare function checkIdShort(referable: IReferable, idShort: string, startsWith?: boolean, strict?: boolean): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves a SubmodelElement (SME) by its `idShort` from a given Submodel (SM) or SubmodelElement (SME).
|
|
46
|
+
* If the `idShort` is not found or if the input is invalid, an empty object is returned.
|
|
47
|
+
*
|
|
48
|
+
* The function supports the following types of elements:
|
|
49
|
+
* - **Submodel (SM)**: Searches through `submodelElements`.
|
|
50
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Searches through their `value` arrays.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} idShort - The `idShort` of the SME to search for.
|
|
53
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
54
|
+
* @returns {ISubmodelElement | undefined} The found SME or an empty object if not found or input is invalid.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getSubmodelElementByIdShort(idShort: string, submodelElement: Submodel | ISubmodelElement): ISubmodelElement | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves an array of SubmodelElements (SMEs) by their `idShort` from a given Submodel (SM) or SubmodelElement (SME).
|
|
59
|
+
* If the `idShort` is not found or if the input is invalid, an empty array is returned.
|
|
60
|
+
*
|
|
61
|
+
* The function supports the following types of elements:
|
|
62
|
+
* - **Submodel (SM)**: Filters through `submodelElements`.
|
|
63
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Filters through their `value` arrays.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} idShort - The `idShort` of the SMEs to search for.
|
|
66
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
67
|
+
* @returns {ISubmodelElement[]} An array of found SMEs matching the `idShort`, or an empty array if not found or input is invalid.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getSubmodelElementsByIdShort(idShort: string, submodelElement: Submodel | ISubmodelElement): ISubmodelElement[];
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { ModelType, } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
//export function useReferableUtils() {
|
|
3
|
+
//const { uuidV4Regex } = useIDUtils();
|
|
4
|
+
const uuidV4Regex = /^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/;
|
|
5
|
+
/**
|
|
6
|
+
* Extracts the display name from a Referable object based on the specified language.
|
|
7
|
+
*
|
|
8
|
+
* The function follows these steps to determine the display name:
|
|
9
|
+
* 1. If a `displayName` entry with the specified language is found, it returns its text.
|
|
10
|
+
* 2. If `defaultNameToDisplay` is provided and not an empty string, it returns this value.
|
|
11
|
+
* 3. If `idShort` is available and not an empty string, it returns `idShort`.
|
|
12
|
+
* 4. If `id` is available and not an empty string, it returns `id`.
|
|
13
|
+
* 5. If none of the above conditions are met, it returns an empty string.
|
|
14
|
+
*
|
|
15
|
+
* @param {IReferable} referable - The Referable object to extract the display name from.
|
|
16
|
+
* @param {string} [language='en'] - The language code for the desired display name text. Defaults to 'en'.
|
|
17
|
+
* @param {string} [defaultNameToDisplay=''] - The default name to return if no display name is found. Defaults to an empty string.
|
|
18
|
+
* @returns {string} The determined display name or an appropriate fallback value.
|
|
19
|
+
*/
|
|
20
|
+
export function nameToDisplay(referable, language = 'en', defaultNameToDisplay = '') {
|
|
21
|
+
if (referable && Object.keys(referable).length > 0) {
|
|
22
|
+
// 1.) Check if displayName is available, if so, return displayName
|
|
23
|
+
if (Array.isArray(referable.displayName) && referable.displayName.length > 0) {
|
|
24
|
+
const displayNameEn = referable.displayName.find((d) => d.language === language && d.text?.trim() !== '');
|
|
25
|
+
if (displayNameEn)
|
|
26
|
+
return displayNameEn.text;
|
|
27
|
+
}
|
|
28
|
+
// 2.) Otherwise return defaultNameToDisplay (if specified)
|
|
29
|
+
if (defaultNameToDisplay.trim() !== '')
|
|
30
|
+
return defaultNameToDisplay;
|
|
31
|
+
// 3.) Otherwise return idShort (if available and not empty string)
|
|
32
|
+
if (referable?.idShort && referable?.idShort.trim() !== '')
|
|
33
|
+
return referable.idShort;
|
|
34
|
+
// 4.) If referable is also an identifiable at the same time return id (if available and not empty string)
|
|
35
|
+
if (hasId(referable) && referable.id?.trim()) {
|
|
36
|
+
const isSubmodelElementListChild = hasParent(referable) && referable.parent.modelType === 'SubmodelElementList';
|
|
37
|
+
// Note: Constraint AASd-120: idShort of submodel elements being a direct child of a SubmodelElementList shall not be specified.
|
|
38
|
+
// This condition avoids the output of an UUID v4
|
|
39
|
+
if (isSubmodelElementListChild || uuidV4Regex.test(referable.id)) {
|
|
40
|
+
return defaultNameToDisplay.trim() || '';
|
|
41
|
+
}
|
|
42
|
+
return referable.id;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 4.) Return defaultNameToDisplay if specified, otherwise return an empty string
|
|
46
|
+
return defaultNameToDisplay.trim() || '';
|
|
47
|
+
}
|
|
48
|
+
function hasId(referable) {
|
|
49
|
+
return typeof referable?.id === 'string';
|
|
50
|
+
}
|
|
51
|
+
function hasParent(obj) {
|
|
52
|
+
return typeof obj?.parent?.modelType === 'string';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extracts the description from a Referable object based on the specified language.
|
|
56
|
+
* If no suitable description is found, it returns a default description.
|
|
57
|
+
*
|
|
58
|
+
* The function checks if the Referable object has a non-empty `description` array,
|
|
59
|
+
* and then it attempts to find a description in the specified language (default is English).
|
|
60
|
+
*
|
|
61
|
+
* @param {IReferable} referable - The Referable object containing descriptions.
|
|
62
|
+
* @param {string} [language='en'] - The language code indicating the desired description language.
|
|
63
|
+
* @param {string} [defaultDescriptionToDisplay=''] - The default description to return if no matching description is found.
|
|
64
|
+
* @returns {string} The text of the found description in the specified language or the default description if not found.
|
|
65
|
+
*/
|
|
66
|
+
export function descriptionToDisplay(referable, language = 'en', defaultDescriptionToDisplay = '') {
|
|
67
|
+
if (referable &&
|
|
68
|
+
Object.keys(referable).length > 0 &&
|
|
69
|
+
Array.isArray(referable?.description) &&
|
|
70
|
+
referable?.description.length > 0) {
|
|
71
|
+
const descriptionEn = referable.description.find((description) => description && description.language === language && description.text !== '');
|
|
72
|
+
if (descriptionEn && descriptionEn.text)
|
|
73
|
+
return descriptionEn.text;
|
|
74
|
+
}
|
|
75
|
+
return defaultDescriptionToDisplay;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks if the `idShort` of a Referable object matches the given `idShort`.
|
|
79
|
+
* The comparison can be performed in two modes:
|
|
80
|
+
* - **startsWith**: checks if the `idShort` of the Referable object starts with the given `idShort`.
|
|
81
|
+
* - **strict**: indicates whether the comparison should consider case sensitivity.
|
|
82
|
+
*
|
|
83
|
+
* @param {IReferable} referable - The Referable object containing the `idShort` to check.
|
|
84
|
+
* @param {string} idShort - The `idShort` string to compare against the Referable's `idShort`.
|
|
85
|
+
* @param {boolean} [startsWith=false] - If true, checks if the Referable's `idShort` starts with the given `idShort`.
|
|
86
|
+
* @param {boolean} [strict=false] - If true, the check will be case-sensitive.
|
|
87
|
+
* @returns {boolean} Returns true if a matching `idShort` is found, false otherwise.
|
|
88
|
+
*/
|
|
89
|
+
export function checkIdShort(referable, idShort, startsWith = false, strict = false) {
|
|
90
|
+
if (idShort.trim() === '')
|
|
91
|
+
return false;
|
|
92
|
+
if (!referable || Object.keys(referable).length === 0 || !referable?.idShort || referable?.idShort.trim() === '')
|
|
93
|
+
return false;
|
|
94
|
+
if (startsWith) {
|
|
95
|
+
// For matching e.g. ProductImage{00} with idShort ProductImage
|
|
96
|
+
// For matching e.g. Markings__00__
|
|
97
|
+
if (strict) {
|
|
98
|
+
return (referable.idShort === idShort ||
|
|
99
|
+
referable.idShort.startsWith(idShort + '{') ||
|
|
100
|
+
referable.idShort.startsWith(idShort + '__'));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return (referable.idShort.toLowerCase() === idShort.toLowerCase() ||
|
|
104
|
+
referable.idShort.toLowerCase().startsWith(idShort.toLowerCase() + '{') ||
|
|
105
|
+
referable.idShort.toLowerCase().startsWith(idShort.toLowerCase() + '__'));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
if (strict) {
|
|
110
|
+
return referable.idShort === idShort;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return referable.idShort.toLowerCase() === idShort.toLowerCase();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves a SubmodelElement (SME) by its `idShort` from a given Submodel (SM) or SubmodelElement (SME).
|
|
119
|
+
* If the `idShort` is not found or if the input is invalid, an empty object is returned.
|
|
120
|
+
*
|
|
121
|
+
* The function supports the following types of elements:
|
|
122
|
+
* - **Submodel (SM)**: Searches through `submodelElements`.
|
|
123
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Searches through their `value` arrays.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} idShort - The `idShort` of the SME to search for.
|
|
126
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
127
|
+
* @returns {ISubmodelElement | undefined} The found SME or an empty object if not found or input is invalid.
|
|
128
|
+
*/
|
|
129
|
+
export function getSubmodelElementByIdShort(idShort, submodelElement) {
|
|
130
|
+
if (idShort.trim() == '')
|
|
131
|
+
return undefined;
|
|
132
|
+
if (!submodelElement?.modelType)
|
|
133
|
+
return undefined;
|
|
134
|
+
switch (submodelElement.modelType()) {
|
|
135
|
+
case ModelType.Submodel: {
|
|
136
|
+
const submodel = submodelElement;
|
|
137
|
+
if (submodel.submodelElements && submodel.submodelElements.length > 0) {
|
|
138
|
+
return submodel.submodelElements.find((sme) => {
|
|
139
|
+
return checkIdShort(sme, idShort);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case ModelType.SubmodelElementCollection: {
|
|
145
|
+
const collection = submodelElement;
|
|
146
|
+
if (collection.value && collection.value.length > 0) {
|
|
147
|
+
return collection.value.find((sme) => {
|
|
148
|
+
return checkIdShort(sme, idShort);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case ModelType.SubmodelElementList: {
|
|
154
|
+
const list = submodelElement;
|
|
155
|
+
if (list.value && list.value.length > 0) {
|
|
156
|
+
return list.value.find((sme) => {
|
|
157
|
+
return checkIdShort(sme, idShort);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Retrieves an array of SubmodelElements (SMEs) by their `idShort` from a given Submodel (SM) or SubmodelElement (SME).
|
|
167
|
+
* If the `idShort` is not found or if the input is invalid, an empty array is returned.
|
|
168
|
+
*
|
|
169
|
+
* The function supports the following types of elements:
|
|
170
|
+
* - **Submodel (SM)**: Filters through `submodelElements`.
|
|
171
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Filters through their `value` arrays.
|
|
172
|
+
*
|
|
173
|
+
* @param {string} idShort - The `idShort` of the SMEs to search for.
|
|
174
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
175
|
+
* @returns {ISubmodelElement[]} An array of found SMEs matching the `idShort`, or an empty array if not found or input is invalid.
|
|
176
|
+
*/
|
|
177
|
+
export function getSubmodelElementsByIdShort(idShort, submodelElement) {
|
|
178
|
+
if (idShort.trim() == '')
|
|
179
|
+
return [];
|
|
180
|
+
if (!submodelElement?.modelType)
|
|
181
|
+
return [];
|
|
182
|
+
switch (submodelElement.modelType()) {
|
|
183
|
+
case ModelType.Submodel: {
|
|
184
|
+
const submodel = submodelElement;
|
|
185
|
+
if (submodel.submodelElements && submodel.submodelElements.length > 0) {
|
|
186
|
+
return submodel.submodelElements.filter((sme) => {
|
|
187
|
+
return checkIdShort(sme, idShort);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
case ModelType.SubmodelElementCollection: {
|
|
193
|
+
const collection = submodelElement;
|
|
194
|
+
if (collection.value && collection.value.length > 0) {
|
|
195
|
+
return collection.value.filter((sme) => {
|
|
196
|
+
return checkIdShort(sme, idShort);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case ModelType.SubmodelElementList: {
|
|
202
|
+
const list = submodelElement;
|
|
203
|
+
if (list.value && list.value.length > 0) {
|
|
204
|
+
return list.value.filter((sme) => {
|
|
205
|
+
return checkIdShort(sme, idShort);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
// return {
|
|
214
|
+
// nameToDisplay,
|
|
215
|
+
// descriptionToDisplay,
|
|
216
|
+
// checkIdShort,
|
|
217
|
+
// getSubmodelElementByIdShort,
|
|
218
|
+
// getSubmodelElementsByIdShort,
|
|
219
|
+
// };
|
|
220
|
+
//}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KeyTypes, Reference } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the ID (Key) from a Reference object based on the given Key Type.
|
|
4
|
+
*
|
|
5
|
+
* @param {Reference} reference - The Reference object containing ID/Key information.
|
|
6
|
+
* @param {KeyTypes} keyType - The enum value of the key type.
|
|
7
|
+
* @returns {string} The ID (Key) of the matching Key Type name if found, otherwise an empty string.
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractId(reference: Reference, keyType: KeyTypes): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//import {keyTypes} from '../utils/KeyTypesUtil';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the ID (Key) from a Reference object based on the given Key Type.
|
|
4
|
+
*
|
|
5
|
+
* @param {Reference} reference - The Reference object containing ID/Key information.
|
|
6
|
+
* @param {KeyTypes} keyType - The enum value of the key type.
|
|
7
|
+
* @returns {string} The ID (Key) of the matching Key Type name if found, otherwise an empty string.
|
|
8
|
+
*/
|
|
9
|
+
export function extractId(reference, keyType) {
|
|
10
|
+
const failResponse = '';
|
|
11
|
+
if (!reference?.keys || reference.keys.length === 0) {
|
|
12
|
+
return failResponse;
|
|
13
|
+
}
|
|
14
|
+
//keyType = keyType.trim();
|
|
15
|
+
// if (!keyTypes.some((keyTypeOfKeyTypes) => keyTypeOfKeyTypes.type === keyType)) {
|
|
16
|
+
// return failResponse;
|
|
17
|
+
// }
|
|
18
|
+
const keys = reference.keys;
|
|
19
|
+
// find the key based on the key type
|
|
20
|
+
const key = keys.find((key) => key?.type === keyType);
|
|
21
|
+
return key?.value?.trim() || failResponse;
|
|
22
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ISubmodelElement, Submodel } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the `semanticId` of a SubmodelElement (SME) matches the given `semanticId`.
|
|
4
|
+
* The function verifies that the `semanticId` is non-empty and that the SubmodelElement
|
|
5
|
+
* contains a valid array of semantic ID keys. It also determines the matching strategy
|
|
6
|
+
* based on the prefix of the keys in the SubmodelElement's semantic ID.
|
|
7
|
+
*
|
|
8
|
+
* @param {ISubmodelElement} submodelElement - The SubmodelElement object containing semantic ID keys.
|
|
9
|
+
* @param {string} semanticId - The `semanticId` string to compare against the SME's `semanticId`.
|
|
10
|
+
* @returns {boolean} Returns true if a matching `semanticId` is found, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkSemanticId(submodelElement: ISubmodelElement, semanticId: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether a given EClass IRDI semantic ID matches an equivalent key value.
|
|
15
|
+
* The function validates that both `keyValue` and `semanticId` are non-empty. It verifies that the `keyValue`
|
|
16
|
+
* starts with either "0173-1#" or "0173/1///" and compares the two IDs based on specific criteria for
|
|
17
|
+
* versioned and non-versioned IDs.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} keyValue - The key value representing the original EClass IRDI ID to compare against.
|
|
20
|
+
* @param {string} semanticId - The EClass semantic ID to be checked for equivalence.
|
|
21
|
+
* @returns {boolean} Returns true if the `semanticId` matches the `keyValue`, false otherwise.
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkSemanticIdEclassIrdi(keyValue: string, semanticId: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Checks whether a given EClass IRDI URL semantic ID matches an equivalent key value.
|
|
26
|
+
* The function validates that both `keyValue` and `semanticId` are non-empty and that the `keyValue`
|
|
27
|
+
* starts with the specified base URL. It then checks if the `semanticId` has a version and
|
|
28
|
+
* compares it accordingly.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} keyValue - The key value representing the original EClass IRDI URL to compare against.
|
|
31
|
+
* @param {string} semanticId - The EClass semantic ID to be checked for equivalence.
|
|
32
|
+
* @returns {boolean} Returns true if the `semanticId` matches the `keyValue`, false otherwise.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkSemanticIdEclassIrdiUrl(keyValue: string, semanticId: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks whether a given IEC CDD semantic ID matches the equivalent key value.
|
|
37
|
+
* The function validates that both `keyValue` and `semanticId` are non-empty and start with "0112/".
|
|
38
|
+
* It then determines if the two values are equivalent based on specific criteria for versioned and non-versioned IDs.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} keyValue - The key value representing the original IEC CDD semantic ID to compare against.
|
|
41
|
+
* @param {string} semanticId - The IEC CDD semantic ID to be checked for equivalence.
|
|
42
|
+
* @returns {boolean} Returns true if the `semanticId` matches the `keyValue`, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
export declare function checkSemanticIdIecCdd(keyValue: string, semanticId: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether a given semantic ID matches the equivalent IRI derived from a key value.
|
|
47
|
+
* The function verifies both the validity of the semantic ID and key value, and compares them.
|
|
48
|
+
*
|
|
49
|
+
* It considers:
|
|
50
|
+
* - Validity checks for the `semanticId` and `keyValue` (they must be non-empty and start with http/https).
|
|
51
|
+
* - Normalization of the `keyValue` and `semanticId` by removing any trailing slashes.
|
|
52
|
+
* - Different comparison strategies depending on whether the `semanticId` indicates a versioned or non-versioned IRI.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} keyValue - The key value representing the original IRI to compare against.
|
|
55
|
+
* @param {string} semanticId - The semantic ID IRI to be checked for equivalence.
|
|
56
|
+
* @returns {boolean} Returns true if the `semanticId` matches the equivalent IRI derived from `keyValue`, false otherwise.
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkSemanticIdIri(keyValue: string, semanticId: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Generates an array of equivalent EClass semantic IDs based on the provided `semanticId`.
|
|
61
|
+
* The function checks if the input `semanticId` is valid before generating its equivalents.
|
|
62
|
+
* Valid formats are:
|
|
63
|
+
* - "0173-1#..."
|
|
64
|
+
* - "0173/1///..."
|
|
65
|
+
* - "https://api.eclass-cdp.com/0173-1..."
|
|
66
|
+
*
|
|
67
|
+
* Returns the original `semanticId` and its variations based on specific rules depending on its format:
|
|
68
|
+
* - Converts "0173-1#" to "0173/1///" and an API URL format.
|
|
69
|
+
* - Converts "0173/1///" to "0173-1#" and the corresponding API URL format.
|
|
70
|
+
* - Converts the API URL format back to "0173-1#" and "0173/1///".
|
|
71
|
+
*
|
|
72
|
+
* @param {string} semanticId - The EClass semantic ID to evaluate and convert.
|
|
73
|
+
* @returns {any[]} An array of the original `semanticId` and its equivalent variations,
|
|
74
|
+
* or an empty array if the input is invalid.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getEquivalentEclassSemanticIds(semanticId: string): any[];
|
|
77
|
+
/**
|
|
78
|
+
* Generates an array of equivalent IRI (Internationalized Resource Identifier) semantic IDs
|
|
79
|
+
* based on the given `semanticId`.
|
|
80
|
+
*
|
|
81
|
+
* The function checks if the `semanticId` is a valid IRI (i.e., it starts with "http://" or "https://").
|
|
82
|
+
* It will return an empty array if the `semanticId` is invalid. If the `semanticId` is valid,
|
|
83
|
+
* it will also include variations with a trailing slash or without one in the resultant array.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} semanticId - The semantic ID to evaluate.
|
|
86
|
+
* @returns {any[]} An array containing the original `semanticId` and its equivalent variations,
|
|
87
|
+
* or an empty array if the input is invalid.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getEquivalentIriSemanticIds(semanticId: string): any[];
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves a SubmodelElement (SME) by its `semanticId` from a given Submodel (SM) or SubmodelElement (SME).
|
|
92
|
+
* If the `semanticId` is not found or if the input is invalid, an empty object is returned.
|
|
93
|
+
*
|
|
94
|
+
* The function supports the following types of elements:
|
|
95
|
+
* - **Submodel (SM)**: Searches through `submodelElements`.
|
|
96
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Searches through their `value` arrays.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} semanticId - The `semanticId` of the SME to search for.
|
|
99
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
100
|
+
* @returns {ISubmodelElement | undefined} The found SME or an empty object if not found or input is invalid.
|
|
101
|
+
*/
|
|
102
|
+
export declare function getSubmodelElementBySemanticId(semanticId: string, submodelElement: Submodel | ISubmodelElement): ISubmodelElement | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Retrieves an array of SubmodelElements (SMEs) by their `semanticId` from a given Submodel (SM) or SubmodelElement (SME).
|
|
105
|
+
* If the `semanticId` is not found or if the input is invalid, an empty array is returned.
|
|
106
|
+
*
|
|
107
|
+
* The function supports the following types of elements:
|
|
108
|
+
* - **Submodel (SM)**: Filters through `submodelElements`.
|
|
109
|
+
* - **SubmodelElementCollection (SMC)** and **SubmodelElementList (SML)**: Filters through their `value` arrays.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} semanticId - The `semanticId` of the SMEs to search for.
|
|
112
|
+
* @param {Submodel | ISubmodelElement} submodelElement - The parent SM/SME to search within.
|
|
113
|
+
* @returns {ISubmodelElement[]} An array of found SMEs matching the `idShort`, or an empty array if not found or input is invalid.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getSubmodelElementsBySemanticId(semanticId: string, submodelElement: Submodel | ISubmodelElement): ISubmodelElement[];
|
|
116
|
+
export declare function extractVersionRevision(semanticId: string): {
|
|
117
|
+
version: string;
|
|
118
|
+
revision: string;
|
|
119
|
+
};
|