basyx-typescript-sdk 1.0.3 → 1.1.1
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 +50 -0
- package/bundle/index.cjs +94 -94
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +94 -94
- package/bundle/index.mjs.map +1 -1
- package/dist/lib/aas-dataformat-xml/index.d.ts +1 -0
- package/dist/lib/aas-dataformat-xml/index.js +1 -0
- package/dist/lib/aas-dataformat-xml/xmlization.d.ts +3 -0
- package/dist/lib/aas-dataformat-xml/xmlization.js +1332 -0
- package/dist/models/BaSyxEnvironment.d.ts +3 -0
- package/dist/models/BaSyxEnvironment.js +3 -0
- package/dist/services/AasService.d.ts +6 -6
- package/dist/services/AasService.js +49 -49
- package/dist/services/SubmodelService.d.ts +6 -6
- package/dist/services/SubmodelService.js +45 -45
- package/package.json +11 -2
package/README.md
CHANGED
|
@@ -441,3 +441,53 @@ const endpoint = extractEndpointHref(descriptor, 'AAS-3.0');
|
|
|
441
441
|
const encoded = base64Encode('https://example.com/ids/aas/my-aas');
|
|
442
442
|
// Use in URL: http://localhost:8081/shells/{encoded}
|
|
443
443
|
```
|
|
444
|
+
|
|
445
|
+
### XML Serialization and Deserialization
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
import { serializeXml, deserializeXml } from 'basyx-typescript-sdk';
|
|
449
|
+
import { BaSyxEnvironment } from 'basyx-typescript-sdk';
|
|
450
|
+
import { AssetAdministrationShell, AssetInformation, AssetKind, Submodel, ModellingKind } from '@aas-core-works/aas-core3.0-typescript/types';
|
|
451
|
+
|
|
452
|
+
// Create an environment with AAS and Submodels
|
|
453
|
+
const environment = new BaSyxEnvironment(
|
|
454
|
+
[
|
|
455
|
+
new AssetAdministrationShell(
|
|
456
|
+
'https://example.com/ids/aas/my-aas',
|
|
457
|
+
new AssetInformation(AssetKind.Instance)
|
|
458
|
+
)
|
|
459
|
+
],
|
|
460
|
+
[
|
|
461
|
+
new Submodel(
|
|
462
|
+
'https://example.com/ids/sm/my-submodel',
|
|
463
|
+
null,
|
|
464
|
+
null,
|
|
465
|
+
'MySubmodel',
|
|
466
|
+
null,
|
|
467
|
+
null,
|
|
468
|
+
null,
|
|
469
|
+
ModellingKind.Instance
|
|
470
|
+
)
|
|
471
|
+
],
|
|
472
|
+
[] // conceptDescriptions
|
|
473
|
+
);
|
|
474
|
+
|
|
475
|
+
// Serialize to XML string
|
|
476
|
+
const xmlString = serializeXml(environment);
|
|
477
|
+
console.log(xmlString);
|
|
478
|
+
// Output:
|
|
479
|
+
// <?xml version="1.0" encoding="UTF-8"?>
|
|
480
|
+
// <aas:environment xmlns:aas="https://admin-shell.io/aas/3/1"
|
|
481
|
+
// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
482
|
+
// xsi:schemaLocation="https://admin-shell.io/aas/3/1 AAS.xsd">
|
|
483
|
+
// ...
|
|
484
|
+
// </aas:environment>
|
|
485
|
+
|
|
486
|
+
// Customize namespace prefix (default is 'aas')
|
|
487
|
+
const xmlWithCustomPrefix = serializeXml(environment, 'custom');
|
|
488
|
+
|
|
489
|
+
// Deserialize XML back to BaSyxEnvironment
|
|
490
|
+
const deserializedEnv = deserializeXml(xmlString);
|
|
491
|
+
console.log('AAS:', deserializedEnv.assetAdministrationShells);
|
|
492
|
+
console.log('Submodels:', deserializedEnv.submodels);
|
|
493
|
+
```
|
package/bundle/index.cjs
CHANGED
|
@@ -15649,18 +15649,18 @@ var DescriptorUtils = /*#__PURE__*/Object.freeze({
|
|
|
15649
15649
|
* Submodel Repository, and Concept Description Repository.
|
|
15650
15650
|
*/
|
|
15651
15651
|
class SubmodelService {
|
|
15652
|
-
|
|
15653
|
-
|
|
15652
|
+
submodelRegistryClient;
|
|
15653
|
+
submodelRepositoryClient;
|
|
15654
15654
|
conceptDescriptionClient;
|
|
15655
|
-
|
|
15656
|
-
|
|
15655
|
+
submodelRegistryConfig;
|
|
15656
|
+
submodelRepositoryConfig;
|
|
15657
15657
|
conceptDescriptionRepositoryConfig;
|
|
15658
15658
|
constructor(config) {
|
|
15659
|
-
this.
|
|
15660
|
-
this.
|
|
15659
|
+
this.submodelRegistryClient = new SubmodelRegistryClient();
|
|
15660
|
+
this.submodelRepositoryClient = new SubmodelRepositoryClient();
|
|
15661
15661
|
this.conceptDescriptionClient = new ConceptDescriptionRepositoryClient();
|
|
15662
|
-
this.
|
|
15663
|
-
this.
|
|
15662
|
+
this.submodelRegistryConfig = config.submodelRegistryConfig;
|
|
15663
|
+
this.submodelRepositoryConfig = config.submodelRepositoryConfig;
|
|
15664
15664
|
this.conceptDescriptionRepositoryConfig = config.conceptDescriptionRepositoryConfig;
|
|
15665
15665
|
}
|
|
15666
15666
|
/**
|
|
@@ -15683,9 +15683,9 @@ class SubmodelService {
|
|
|
15683
15683
|
const preferRegistry = options?.preferRegistry ?? true;
|
|
15684
15684
|
const includeConceptDescriptions = options?.includeConceptDescriptions ?? false;
|
|
15685
15685
|
// Try registry first if configured and preferred
|
|
15686
|
-
if (preferRegistry && this.
|
|
15687
|
-
const registryResult = await this.
|
|
15688
|
-
configuration: this.
|
|
15686
|
+
if (preferRegistry && this.submodelRegistryConfig) {
|
|
15687
|
+
const registryResult = await this.submodelRegistryClient.getAllSubmodelDescriptors({
|
|
15688
|
+
configuration: this.submodelRegistryConfig,
|
|
15689
15689
|
limit: options?.limit,
|
|
15690
15690
|
cursor: options?.cursor,
|
|
15691
15691
|
});
|
|
@@ -15717,9 +15717,9 @@ class SubmodelService {
|
|
|
15717
15717
|
}
|
|
15718
15718
|
}
|
|
15719
15719
|
// Fall back to repository if registry failed or not configured
|
|
15720
|
-
if (this.
|
|
15721
|
-
const repositoryResult = await this.
|
|
15722
|
-
configuration: this.
|
|
15720
|
+
if (this.submodelRepositoryConfig) {
|
|
15721
|
+
const repositoryResult = await this.submodelRepositoryClient.getAllSubmodels({
|
|
15722
|
+
configuration: this.submodelRepositoryConfig,
|
|
15723
15723
|
limit: options?.limit,
|
|
15724
15724
|
cursor: options?.cursor,
|
|
15725
15725
|
});
|
|
@@ -15766,9 +15766,9 @@ class SubmodelService {
|
|
|
15766
15766
|
async getSubmodelById(options) {
|
|
15767
15767
|
const { submodelIdentifier, useRegistryEndpoint = true, includeConceptDescriptions = false } = options;
|
|
15768
15768
|
// Try registry-based flow first
|
|
15769
|
-
if (useRegistryEndpoint && this.
|
|
15770
|
-
const descriptorResult = await this.
|
|
15771
|
-
configuration: this.
|
|
15769
|
+
if (useRegistryEndpoint && this.submodelRegistryConfig) {
|
|
15770
|
+
const descriptorResult = await this.submodelRegistryClient.getSubmodelDescriptorById({
|
|
15771
|
+
configuration: this.submodelRegistryConfig,
|
|
15772
15772
|
submodelIdentifier,
|
|
15773
15773
|
});
|
|
15774
15774
|
if (descriptorResult.success) {
|
|
@@ -15796,7 +15796,7 @@ class SubmodelService {
|
|
|
15796
15796
|
}
|
|
15797
15797
|
}
|
|
15798
15798
|
// Fall back to repository
|
|
15799
|
-
if (!this.
|
|
15799
|
+
if (!this.submodelRepositoryConfig) {
|
|
15800
15800
|
return {
|
|
15801
15801
|
success: false,
|
|
15802
15802
|
error: {
|
|
@@ -15805,8 +15805,8 @@ class SubmodelService {
|
|
|
15805
15805
|
},
|
|
15806
15806
|
};
|
|
15807
15807
|
}
|
|
15808
|
-
const submodelResult = await this.
|
|
15809
|
-
configuration: this.
|
|
15808
|
+
const submodelResult = await this.submodelRepositoryClient.getSubmodelById({
|
|
15809
|
+
configuration: this.submodelRepositoryConfig,
|
|
15810
15810
|
submodelIdentifier,
|
|
15811
15811
|
});
|
|
15812
15812
|
if (submodelResult.success) {
|
|
@@ -15843,9 +15843,9 @@ class SubmodelService {
|
|
|
15843
15843
|
async getSubmodelEndpointById(options) {
|
|
15844
15844
|
const { submodelIdentifier, useRegistry = true } = options;
|
|
15845
15845
|
// Try registry first if configured and requested
|
|
15846
|
-
if (useRegistry && this.
|
|
15847
|
-
const descriptorResult = await this.
|
|
15848
|
-
configuration: this.
|
|
15846
|
+
if (useRegistry && this.submodelRegistryConfig) {
|
|
15847
|
+
const descriptorResult = await this.submodelRegistryClient.getSubmodelDescriptorById({
|
|
15848
|
+
configuration: this.submodelRegistryConfig,
|
|
15849
15849
|
submodelIdentifier,
|
|
15850
15850
|
});
|
|
15851
15851
|
if (descriptorResult.success) {
|
|
@@ -15856,7 +15856,7 @@ class SubmodelService {
|
|
|
15856
15856
|
}
|
|
15857
15857
|
}
|
|
15858
15858
|
// Fall back to constructing from repository base
|
|
15859
|
-
if (!this.
|
|
15859
|
+
if (!this.submodelRepositoryConfig) {
|
|
15860
15860
|
return {
|
|
15861
15861
|
success: false,
|
|
15862
15862
|
error: {
|
|
@@ -15865,7 +15865,7 @@ class SubmodelService {
|
|
|
15865
15865
|
},
|
|
15866
15866
|
};
|
|
15867
15867
|
}
|
|
15868
|
-
const repositoryBasePath = this.
|
|
15868
|
+
const repositoryBasePath = this.submodelRepositoryConfig.basePath || 'http://localhost:8082';
|
|
15869
15869
|
const encodedId = base64Encode$1(submodelIdentifier);
|
|
15870
15870
|
const endpoint = `${repositoryBasePath}/submodels/${encodedId}`;
|
|
15871
15871
|
return { success: true, data: endpoint };
|
|
@@ -15902,7 +15902,7 @@ class SubmodelService {
|
|
|
15902
15902
|
// Create configuration for the endpoint
|
|
15903
15903
|
const config = new Configuration({ basePath: baseUrl });
|
|
15904
15904
|
// Fetch the submodel
|
|
15905
|
-
const submodelResult = await this.
|
|
15905
|
+
const submodelResult = await this.submodelRepositoryClient.getSubmodelById({
|
|
15906
15906
|
configuration: config,
|
|
15907
15907
|
submodelIdentifier,
|
|
15908
15908
|
});
|
|
@@ -15938,7 +15938,7 @@ class SubmodelService {
|
|
|
15938
15938
|
*/
|
|
15939
15939
|
async createSubmodel(options) {
|
|
15940
15940
|
const { submodel, registerInRegistry = true } = options;
|
|
15941
|
-
if (!this.
|
|
15941
|
+
if (!this.submodelRepositoryConfig) {
|
|
15942
15942
|
return {
|
|
15943
15943
|
success: false,
|
|
15944
15944
|
error: {
|
|
@@ -15948,18 +15948,18 @@ class SubmodelService {
|
|
|
15948
15948
|
};
|
|
15949
15949
|
}
|
|
15950
15950
|
// Create Submodel in repository
|
|
15951
|
-
const submodelResult = await this.
|
|
15952
|
-
configuration: this.
|
|
15951
|
+
const submodelResult = await this.submodelRepositoryClient.postSubmodel({
|
|
15952
|
+
configuration: this.submodelRepositoryConfig,
|
|
15953
15953
|
submodel: submodel,
|
|
15954
15954
|
});
|
|
15955
15955
|
if (!submodelResult.success) {
|
|
15956
15956
|
return { success: false, error: submodelResult.error };
|
|
15957
15957
|
}
|
|
15958
15958
|
// Register descriptor in registry if configured and requested
|
|
15959
|
-
if (registerInRegistry && this.
|
|
15959
|
+
if (registerInRegistry && this.submodelRegistryConfig) {
|
|
15960
15960
|
const descriptor = this.createDescriptorFromSubmodel(submodel);
|
|
15961
|
-
const descriptorResult = await this.
|
|
15962
|
-
configuration: this.
|
|
15961
|
+
const descriptorResult = await this.submodelRegistryClient.postSubmodelDescriptor({
|
|
15962
|
+
configuration: this.submodelRegistryConfig,
|
|
15963
15963
|
submodelDescriptor: descriptor,
|
|
15964
15964
|
});
|
|
15965
15965
|
if (!descriptorResult.success) {
|
|
@@ -15998,7 +15998,7 @@ class SubmodelService {
|
|
|
15998
15998
|
*/
|
|
15999
15999
|
async updateSubmodel(options) {
|
|
16000
16000
|
const { submodel, updateInRegistry = true } = options;
|
|
16001
|
-
if (!this.
|
|
16001
|
+
if (!this.submodelRepositoryConfig) {
|
|
16002
16002
|
return {
|
|
16003
16003
|
success: false,
|
|
16004
16004
|
error: {
|
|
@@ -16008,8 +16008,8 @@ class SubmodelService {
|
|
|
16008
16008
|
};
|
|
16009
16009
|
}
|
|
16010
16010
|
// Update Submodel in repository
|
|
16011
|
-
const submodelResult = await this.
|
|
16012
|
-
configuration: this.
|
|
16011
|
+
const submodelResult = await this.submodelRepositoryClient.putSubmodelById({
|
|
16012
|
+
configuration: this.submodelRepositoryConfig,
|
|
16013
16013
|
submodelIdentifier: submodel.id,
|
|
16014
16014
|
submodel: submodel,
|
|
16015
16015
|
});
|
|
@@ -16019,10 +16019,10 @@ class SubmodelService {
|
|
|
16019
16019
|
// Use the returned submodel if available, otherwise use the input submodel
|
|
16020
16020
|
const updatedSubmodel = submodelResult.data || submodel;
|
|
16021
16021
|
// Update descriptor in registry if configured and requested
|
|
16022
|
-
if (updateInRegistry && this.
|
|
16022
|
+
if (updateInRegistry && this.submodelRegistryConfig) {
|
|
16023
16023
|
const descriptor = this.createDescriptorFromSubmodel(submodel);
|
|
16024
|
-
const descriptorResult = await this.
|
|
16025
|
-
configuration: this.
|
|
16024
|
+
const descriptorResult = await this.submodelRegistryClient.putSubmodelDescriptorById({
|
|
16025
|
+
configuration: this.submodelRegistryConfig,
|
|
16026
16026
|
submodelIdentifier: submodel.id,
|
|
16027
16027
|
submodelDescriptor: descriptor,
|
|
16028
16028
|
});
|
|
@@ -16062,9 +16062,9 @@ class SubmodelService {
|
|
|
16062
16062
|
async deleteSubmodel(options) {
|
|
16063
16063
|
const { submodelIdentifier, deleteFromRegistry = true } = options;
|
|
16064
16064
|
// Remove from registry first if configured and requested
|
|
16065
|
-
if (deleteFromRegistry && this.
|
|
16066
|
-
const registryResult = await this.
|
|
16067
|
-
configuration: this.
|
|
16065
|
+
if (deleteFromRegistry && this.submodelRegistryConfig) {
|
|
16066
|
+
const registryResult = await this.submodelRegistryClient.deleteSubmodelDescriptorById({
|
|
16067
|
+
configuration: this.submodelRegistryConfig,
|
|
16068
16068
|
submodelIdentifier,
|
|
16069
16069
|
});
|
|
16070
16070
|
if (!registryResult.success) {
|
|
@@ -16072,9 +16072,9 @@ class SubmodelService {
|
|
|
16072
16072
|
}
|
|
16073
16073
|
}
|
|
16074
16074
|
// Remove from repository
|
|
16075
|
-
if (this.
|
|
16076
|
-
const repositoryResult = await this.
|
|
16077
|
-
configuration: this.
|
|
16075
|
+
if (this.submodelRepositoryConfig) {
|
|
16076
|
+
const repositoryResult = await this.submodelRepositoryClient.deleteSubmodelById({
|
|
16077
|
+
configuration: this.submodelRepositoryConfig,
|
|
16078
16078
|
submodelIdentifier,
|
|
16079
16079
|
});
|
|
16080
16080
|
if (!repositoryResult.success) {
|
|
@@ -16092,7 +16092,7 @@ class SubmodelService {
|
|
|
16092
16092
|
*/
|
|
16093
16093
|
createDescriptorFromSubmodel(submodel) {
|
|
16094
16094
|
// Set endpoint using repository base path
|
|
16095
|
-
const repositoryBasePath = this.
|
|
16095
|
+
const repositoryBasePath = this.submodelRepositoryConfig.basePath || 'http://localhost:8082';
|
|
16096
16096
|
const encodedId = base64Encode$1(submodel.id);
|
|
16097
16097
|
const endpoints = [
|
|
16098
16098
|
{
|
|
@@ -16219,24 +16219,24 @@ class SubmodelService {
|
|
|
16219
16219
|
* by coordinating operations across these BaSyx components, demonstrating the multi-client pattern.
|
|
16220
16220
|
*/
|
|
16221
16221
|
class AasService {
|
|
16222
|
-
|
|
16223
|
-
|
|
16222
|
+
aasRegistryClient;
|
|
16223
|
+
aasRepositoryClient;
|
|
16224
16224
|
discoveryClient;
|
|
16225
|
-
|
|
16226
|
-
|
|
16225
|
+
aasRegistryConfig;
|
|
16226
|
+
aasRepositoryConfig;
|
|
16227
16227
|
discoveryConfig;
|
|
16228
16228
|
submodelService;
|
|
16229
16229
|
constructor(config) {
|
|
16230
|
-
this.
|
|
16231
|
-
this.
|
|
16230
|
+
this.aasRegistryClient = new AasRegistryClient();
|
|
16231
|
+
this.aasRepositoryClient = new AasRepositoryClient();
|
|
16232
16232
|
this.discoveryClient = new AasDiscoveryClient();
|
|
16233
|
-
this.
|
|
16234
|
-
this.
|
|
16233
|
+
this.aasRegistryConfig = config.aasRegistryConfig;
|
|
16234
|
+
this.aasRepositoryConfig = config.aasRepositoryConfig;
|
|
16235
16235
|
this.discoveryConfig = config.discoveryConfig;
|
|
16236
16236
|
// Use separate submodel configs if provided, otherwise fall back to AAS configs
|
|
16237
16237
|
this.submodelService = new SubmodelService({
|
|
16238
|
-
|
|
16239
|
-
|
|
16238
|
+
submodelRegistryConfig: config.submodelRegistryConfig ?? config.aasRegistryConfig,
|
|
16239
|
+
submodelRepositoryConfig: config.submodelRepositoryConfig ?? config.aasRepositoryConfig,
|
|
16240
16240
|
conceptDescriptionRepositoryConfig: config.conceptDescriptionRepositoryConfig,
|
|
16241
16241
|
});
|
|
16242
16242
|
}
|
|
@@ -16261,9 +16261,9 @@ class AasService {
|
|
|
16261
16261
|
const preferRegistry = options?.preferRegistry ?? true;
|
|
16262
16262
|
const includeSubmodels = options?.includeSubmodels ?? false;
|
|
16263
16263
|
// Try registry first if configured and preferred
|
|
16264
|
-
if (preferRegistry && this.
|
|
16265
|
-
const registryResult = await this.
|
|
16266
|
-
configuration: this.
|
|
16264
|
+
if (preferRegistry && this.aasRegistryConfig) {
|
|
16265
|
+
const registryResult = await this.aasRegistryClient.getAllAssetAdministrationShellDescriptors({
|
|
16266
|
+
configuration: this.aasRegistryConfig,
|
|
16267
16267
|
limit: options?.limit,
|
|
16268
16268
|
cursor: options?.cursor,
|
|
16269
16269
|
});
|
|
@@ -16276,7 +16276,7 @@ class AasService {
|
|
|
16276
16276
|
// Extract base URL from endpoint (remove /shells/{id} part)
|
|
16277
16277
|
const baseUrl = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)/)?.[1] || endpoint;
|
|
16278
16278
|
const config = new Configuration({ basePath: baseUrl });
|
|
16279
|
-
const shellResult = await this.
|
|
16279
|
+
const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
|
|
16280
16280
|
configuration: config,
|
|
16281
16281
|
aasIdentifier: descriptor.id,
|
|
16282
16282
|
});
|
|
@@ -16301,9 +16301,9 @@ class AasService {
|
|
|
16301
16301
|
}
|
|
16302
16302
|
}
|
|
16303
16303
|
// Fall back to repository if registry failed or not configured
|
|
16304
|
-
if (this.
|
|
16305
|
-
const repositoryResult = await this.
|
|
16306
|
-
configuration: this.
|
|
16304
|
+
if (this.aasRepositoryConfig) {
|
|
16305
|
+
const repositoryResult = await this.aasRepositoryClient.getAllAssetAdministrationShells({
|
|
16306
|
+
configuration: this.aasRepositoryConfig,
|
|
16307
16307
|
limit: options?.limit,
|
|
16308
16308
|
cursor: options?.cursor,
|
|
16309
16309
|
});
|
|
@@ -16351,9 +16351,9 @@ class AasService {
|
|
|
16351
16351
|
async getAasById(options) {
|
|
16352
16352
|
const { aasIdentifier, useRegistryEndpoint = true, includeSubmodels = false } = options;
|
|
16353
16353
|
// Try registry-based flow first
|
|
16354
|
-
if (useRegistryEndpoint && this.
|
|
16355
|
-
const descriptorResult = await this.
|
|
16356
|
-
configuration: this.
|
|
16354
|
+
if (useRegistryEndpoint && this.aasRegistryConfig) {
|
|
16355
|
+
const descriptorResult = await this.aasRegistryClient.getAssetAdministrationShellDescriptorById({
|
|
16356
|
+
configuration: this.aasRegistryConfig,
|
|
16357
16357
|
aasIdentifier,
|
|
16358
16358
|
});
|
|
16359
16359
|
if (descriptorResult.success) {
|
|
@@ -16364,7 +16364,7 @@ class AasService {
|
|
|
16364
16364
|
const baseUrl = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)/)?.[1] || endpoint;
|
|
16365
16365
|
// Try to fetch from descriptor endpoint
|
|
16366
16366
|
const config = new Configuration({ basePath: baseUrl });
|
|
16367
|
-
const shellResult = await this.
|
|
16367
|
+
const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
|
|
16368
16368
|
configuration: config,
|
|
16369
16369
|
aasIdentifier,
|
|
16370
16370
|
});
|
|
@@ -16389,7 +16389,7 @@ class AasService {
|
|
|
16389
16389
|
}
|
|
16390
16390
|
}
|
|
16391
16391
|
// Fall back to repository
|
|
16392
|
-
if (!this.
|
|
16392
|
+
if (!this.aasRepositoryConfig) {
|
|
16393
16393
|
return {
|
|
16394
16394
|
success: false,
|
|
16395
16395
|
error: {
|
|
@@ -16398,8 +16398,8 @@ class AasService {
|
|
|
16398
16398
|
},
|
|
16399
16399
|
};
|
|
16400
16400
|
}
|
|
16401
|
-
const shellResult = await this.
|
|
16402
|
-
configuration: this.
|
|
16401
|
+
const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
|
|
16402
|
+
configuration: this.aasRepositoryConfig,
|
|
16403
16403
|
aasIdentifier,
|
|
16404
16404
|
});
|
|
16405
16405
|
if (shellResult.success) {
|
|
@@ -16437,9 +16437,9 @@ class AasService {
|
|
|
16437
16437
|
async getAasEndpointById(options) {
|
|
16438
16438
|
const { aasIdentifier, useRegistry = true } = options;
|
|
16439
16439
|
// Try registry first if configured and requested
|
|
16440
|
-
if (useRegistry && this.
|
|
16441
|
-
const descriptorResult = await this.
|
|
16442
|
-
configuration: this.
|
|
16440
|
+
if (useRegistry && this.aasRegistryConfig) {
|
|
16441
|
+
const descriptorResult = await this.aasRegistryClient.getAssetAdministrationShellDescriptorById({
|
|
16442
|
+
configuration: this.aasRegistryConfig,
|
|
16443
16443
|
aasIdentifier,
|
|
16444
16444
|
});
|
|
16445
16445
|
if (descriptorResult.success) {
|
|
@@ -16450,7 +16450,7 @@ class AasService {
|
|
|
16450
16450
|
}
|
|
16451
16451
|
}
|
|
16452
16452
|
// Fall back to constructing from repository base
|
|
16453
|
-
if (!this.
|
|
16453
|
+
if (!this.aasRepositoryConfig) {
|
|
16454
16454
|
return {
|
|
16455
16455
|
success: false,
|
|
16456
16456
|
error: {
|
|
@@ -16459,7 +16459,7 @@ class AasService {
|
|
|
16459
16459
|
},
|
|
16460
16460
|
};
|
|
16461
16461
|
}
|
|
16462
|
-
const repositoryBasePath = this.
|
|
16462
|
+
const repositoryBasePath = this.aasRepositoryConfig.basePath || 'http://localhost:8081';
|
|
16463
16463
|
const encodedId = base64Encode$1(aasIdentifier);
|
|
16464
16464
|
const endpoint = `${repositoryBasePath}/shells/${encodedId}`;
|
|
16465
16465
|
return { success: true, data: endpoint };
|
|
@@ -16497,7 +16497,7 @@ class AasService {
|
|
|
16497
16497
|
// Create configuration for the endpoint
|
|
16498
16498
|
const config = new Configuration({ basePath: baseUrl });
|
|
16499
16499
|
// Fetch the shell
|
|
16500
|
-
const shellResult = await this.
|
|
16500
|
+
const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
|
|
16501
16501
|
configuration: config,
|
|
16502
16502
|
aasIdentifier,
|
|
16503
16503
|
});
|
|
@@ -16534,7 +16534,7 @@ class AasService {
|
|
|
16534
16534
|
*/
|
|
16535
16535
|
async createAas(options) {
|
|
16536
16536
|
const { shell, registerInRegistry = true } = options;
|
|
16537
|
-
if (!this.
|
|
16537
|
+
if (!this.aasRepositoryConfig) {
|
|
16538
16538
|
return {
|
|
16539
16539
|
success: false,
|
|
16540
16540
|
error: {
|
|
@@ -16544,18 +16544,18 @@ class AasService {
|
|
|
16544
16544
|
};
|
|
16545
16545
|
}
|
|
16546
16546
|
// Create AAS in repository
|
|
16547
|
-
const shellResult = await this.
|
|
16548
|
-
configuration: this.
|
|
16547
|
+
const shellResult = await this.aasRepositoryClient.postAssetAdministrationShell({
|
|
16548
|
+
configuration: this.aasRepositoryConfig,
|
|
16549
16549
|
assetAdministrationShell: shell,
|
|
16550
16550
|
});
|
|
16551
16551
|
if (!shellResult.success) {
|
|
16552
16552
|
return { success: false, error: shellResult.error };
|
|
16553
16553
|
}
|
|
16554
16554
|
// Register descriptor in registry if configured and requested
|
|
16555
|
-
if (registerInRegistry && this.
|
|
16555
|
+
if (registerInRegistry && this.aasRegistryConfig) {
|
|
16556
16556
|
const descriptor = this.createDescriptorFromAas(shell);
|
|
16557
|
-
const descriptorResult = await this.
|
|
16558
|
-
configuration: this.
|
|
16557
|
+
const descriptorResult = await this.aasRegistryClient.postAssetAdministrationShellDescriptor({
|
|
16558
|
+
configuration: this.aasRegistryConfig,
|
|
16559
16559
|
assetAdministrationShellDescriptor: descriptor,
|
|
16560
16560
|
});
|
|
16561
16561
|
if (!descriptorResult.success) {
|
|
@@ -16594,7 +16594,7 @@ class AasService {
|
|
|
16594
16594
|
*/
|
|
16595
16595
|
async updateAas(options) {
|
|
16596
16596
|
const { shell, updateInRegistry = true } = options;
|
|
16597
|
-
if (!this.
|
|
16597
|
+
if (!this.aasRepositoryConfig) {
|
|
16598
16598
|
return {
|
|
16599
16599
|
success: false,
|
|
16600
16600
|
error: {
|
|
@@ -16604,8 +16604,8 @@ class AasService {
|
|
|
16604
16604
|
};
|
|
16605
16605
|
}
|
|
16606
16606
|
// Update AAS in repository
|
|
16607
|
-
const shellResult = await this.
|
|
16608
|
-
configuration: this.
|
|
16607
|
+
const shellResult = await this.aasRepositoryClient.putAssetAdministrationShellById({
|
|
16608
|
+
configuration: this.aasRepositoryConfig,
|
|
16609
16609
|
aasIdentifier: shell.id,
|
|
16610
16610
|
assetAdministrationShell: shell,
|
|
16611
16611
|
});
|
|
@@ -16615,10 +16615,10 @@ class AasService {
|
|
|
16615
16615
|
// Use the returned shell if available, otherwise use the input shell
|
|
16616
16616
|
const updatedShell = shellResult.data || shell;
|
|
16617
16617
|
// Update descriptor in registry if configured and requested
|
|
16618
|
-
if (updateInRegistry && this.
|
|
16618
|
+
if (updateInRegistry && this.aasRegistryConfig) {
|
|
16619
16619
|
const descriptor = this.createDescriptorFromAas(shell);
|
|
16620
|
-
const descriptorResult = await this.
|
|
16621
|
-
configuration: this.
|
|
16620
|
+
const descriptorResult = await this.aasRegistryClient.putAssetAdministrationShellDescriptorById({
|
|
16621
|
+
configuration: this.aasRegistryConfig,
|
|
16622
16622
|
aasIdentifier: shell.id,
|
|
16623
16623
|
assetAdministrationShellDescriptor: descriptor,
|
|
16624
16624
|
});
|
|
@@ -16660,9 +16660,9 @@ class AasService {
|
|
|
16660
16660
|
async deleteAas(options) {
|
|
16661
16661
|
const { aasIdentifier, deleteFromRegistry = true } = options;
|
|
16662
16662
|
// Remove from registry first if configured and requested
|
|
16663
|
-
if (deleteFromRegistry && this.
|
|
16664
|
-
const registryResult = await this.
|
|
16665
|
-
configuration: this.
|
|
16663
|
+
if (deleteFromRegistry && this.aasRegistryConfig) {
|
|
16664
|
+
const registryResult = await this.aasRegistryClient.deleteAssetAdministrationShellDescriptorById({
|
|
16665
|
+
configuration: this.aasRegistryConfig,
|
|
16666
16666
|
aasIdentifier,
|
|
16667
16667
|
});
|
|
16668
16668
|
if (!registryResult.success) {
|
|
@@ -16670,9 +16670,9 @@ class AasService {
|
|
|
16670
16670
|
}
|
|
16671
16671
|
}
|
|
16672
16672
|
// Remove from repository
|
|
16673
|
-
if (this.
|
|
16674
|
-
const repoResult = await this.
|
|
16675
|
-
configuration: this.
|
|
16673
|
+
if (this.aasRepositoryConfig) {
|
|
16674
|
+
const repoResult = await this.aasRepositoryClient.deleteAssetAdministrationShellById({
|
|
16675
|
+
configuration: this.aasRepositoryConfig,
|
|
16676
16676
|
aasIdentifier,
|
|
16677
16677
|
});
|
|
16678
16678
|
if (!repoResult.success) {
|
|
@@ -16874,7 +16874,7 @@ class AasService {
|
|
|
16874
16874
|
null // endpoints set below
|
|
16875
16875
|
);
|
|
16876
16876
|
// Set endpoint using repository base path
|
|
16877
|
-
const repositoryBasePath = this.
|
|
16877
|
+
const repositoryBasePath = this.aasRepositoryConfig.basePath || 'http://localhost:8081';
|
|
16878
16878
|
const encodedId = base64Encode$1(shell.id);
|
|
16879
16879
|
descriptor.endpoints = [
|
|
16880
16880
|
{
|