basyx-typescript-sdk 2.3.1 → 2.4.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.
Files changed (64) hide show
  1. package/README.md +68 -1
  2. package/bundle/index.cjs +1463 -105
  3. package/bundle/index.cjs.map +1 -1
  4. package/bundle/index.mjs +1395 -106
  5. package/bundle/index.mjs.map +1 -1
  6. package/dist/clients/AasRegistryClient.d.ts +20 -0
  7. package/dist/clients/AasRegistryClient.js +40 -0
  8. package/dist/clients/AasRepositoryClient.d.ts +31 -3
  9. package/dist/clients/AasRepositoryClient.js +61 -4
  10. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +20 -0
  11. package/dist/clients/ConceptDescriptionRepositoryClient.js +40 -0
  12. package/dist/clients/SubmodelRegistryClient.d.ts +20 -0
  13. package/dist/clients/SubmodelRegistryClient.js +40 -0
  14. package/dist/clients/SubmodelRepositoryClient.d.ts +33 -7
  15. package/dist/clients/SubmodelRepositoryClient.js +61 -12
  16. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +14 -1
  17. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +29 -0
  18. package/dist/generated/AasRegistryService/models/index.d.ts +374 -0
  19. package/dist/generated/AasRegistryService/models/index.js +6 -0
  20. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +14 -1
  21. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +29 -0
  22. package/dist/generated/AasRepositoryService/models/index.d.ts +381 -0
  23. package/dist/generated/AasRepositoryService/models/index.js +7 -0
  24. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +14 -1
  25. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +29 -0
  26. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +381 -0
  27. package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +7 -0
  28. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +14 -1
  29. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +29 -0
  30. package/dist/generated/SubmodelRegistryService/models/index.d.ts +381 -0
  31. package/dist/generated/SubmodelRegistryService/models/index.js +7 -0
  32. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +14 -3
  33. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +31 -8
  34. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +381 -0
  35. package/dist/generated/SubmodelRepositoryService/models/index.js +7 -0
  36. package/dist/lib/endpointConfiguration.d.ts +71 -0
  37. package/dist/lib/endpointConfiguration.js +101 -0
  38. package/dist/lib/index.d.ts +1 -0
  39. package/dist/lib/index.js +2 -0
  40. package/dist/lib/operationHandle.d.ts +10 -0
  41. package/dist/lib/operationHandle.js +26 -0
  42. package/dist/lib/queryJsonization.d.ts +17 -0
  43. package/dist/lib/queryJsonization.js +309 -0
  44. package/dist/lib/queryRequests.d.ts +24 -0
  45. package/dist/lib/queryRequests.js +44 -0
  46. package/dist/models/Query.d.ts +378 -0
  47. package/dist/models/Query.js +430 -0
  48. package/dist/models/QueryResult.d.ts +22 -0
  49. package/dist/models/QueryResult.js +1 -0
  50. package/dist/models/api.d.ts +10 -0
  51. package/dist/models/index.d.ts +2 -0
  52. package/dist/models/index.js +2 -0
  53. package/dist/services/AasService.d.ts +15 -4
  54. package/dist/services/AasService.js +38 -40
  55. package/dist/services/SubmodelService.d.ts +9 -8
  56. package/dist/services/SubmodelService.js +17 -34
  57. package/dist/services/index.d.ts +1 -0
  58. package/dist/utils/DescriptorUtils.d.ts +27 -1
  59. package/dist/utils/DescriptorUtils.js +65 -27
  60. package/dist/utils/ServiceDescriptionUtils.d.ts +30 -0
  61. package/dist/utils/ServiceDescriptionUtils.js +43 -0
  62. package/dist/utils/index.d.ts +2 -0
  63. package/dist/utils/index.js +2 -0
  64. package/package.json +1 -1
package/bundle/index.mjs CHANGED
@@ -1470,6 +1470,29 @@ var AssetAdministrationShellRepositoryAPIApi = class extends BaseAPI {
1470
1470
  async putThumbnailAasRepository(requestParameters, initOverrides) {
1471
1471
  await this.putThumbnailAasRepositoryRaw(requestParameters, initOverrides);
1472
1472
  }
1473
+ /**
1474
+ * Returns all Asset Administration Shells that conform to the input query
1475
+ */
1476
+ async queryAssetAdministrationShellsRaw(requestParameters, initOverrides) {
1477
+ const queryParameters = {};
1478
+ if (requestParameters["limit"] != null) queryParameters["limit"] = requestParameters["limit"];
1479
+ if (requestParameters["cursor"] != null) queryParameters["cursor"] = requestParameters["cursor"];
1480
+ const headerParameters = {};
1481
+ headerParameters["Content-Type"] = "application/json";
1482
+ return new JSONApiResponse(await this.request({
1483
+ path: `/query/shells`,
1484
+ method: "POST",
1485
+ headers: headerParameters,
1486
+ query: queryParameters,
1487
+ body: requestParameters["query"]
1488
+ }, initOverrides));
1489
+ }
1490
+ /**
1491
+ * Returns all Asset Administration Shells that conform to the input query
1492
+ */
1493
+ async queryAssetAdministrationShells(requestParameters = {}, initOverrides) {
1494
+ return await (await this.queryAssetAdministrationShellsRaw(requestParameters, initOverrides)).value();
1495
+ }
1473
1496
  };
1474
1497
  /**
1475
1498
  * @export
@@ -1886,6 +1909,13 @@ const QualifierKind$3 = {
1886
1909
  ValueQualifier: "ValueQualifier"
1887
1910
  };
1888
1911
  /**
1912
+ * @export
1913
+ */
1914
+ const QueryResultAssetAdministrationShellPagingMetadataResultTypeEnum = {
1915
+ AssetAdministrationShell: "AssetAdministrationShell",
1916
+ Identifier: "Identifier"
1917
+ };
1918
+ /**
1889
1919
  *
1890
1920
  * @export
1891
1921
  */
@@ -1947,6 +1977,7 @@ var AasRepositoryService_exports = /* @__PURE__ */ __exportAll({
1947
1977
  PatchSubmodelElementValueByPathAasRepositoryLevelEnum: () => PatchSubmodelElementValueByPathAasRepositoryLevelEnum,
1948
1978
  PatchSubmodelElementValueByPathValueOnlyLevelEnum: () => PatchSubmodelElementValueByPathValueOnlyLevelEnum,
1949
1979
  QualifierKind: () => QualifierKind$3,
1980
+ QueryResultAssetAdministrationShellPagingMetadataResultTypeEnum: () => QueryResultAssetAdministrationShellPagingMetadataResultTypeEnum,
1950
1981
  ReferenceTypes: () => ReferenceTypes$6,
1951
1982
  RequiredError: () => RequiredError,
1952
1983
  ResponseError: () => ResponseError,
@@ -2640,7 +2671,6 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
2640
2671
  * Asynchronously invokes an Operation at a specified path
2641
2672
  */
2642
2673
  async invokeOperationAsyncValueOnlyRaw(requestParameters, initOverrides) {
2643
- if (requestParameters["aasIdentifier"] == null) throw new RequiredError("aasIdentifier", "Required parameter \"aasIdentifier\" was null or undefined when calling invokeOperationAsyncValueOnly().");
2644
2674
  if (requestParameters["submodelIdentifier"] == null) throw new RequiredError("submodelIdentifier", "Required parameter \"submodelIdentifier\" was null or undefined when calling invokeOperationAsyncValueOnly().");
2645
2675
  if (requestParameters["idShortPath"] == null) throw new RequiredError("idShortPath", "Required parameter \"idShortPath\" was null or undefined when calling invokeOperationAsyncValueOnly().");
2646
2676
  if (requestParameters["operationRequestValueOnly"] == null) throw new RequiredError("operationRequestValueOnly", "Required parameter \"operationRequestValueOnly\" was null or undefined when calling invokeOperationAsyncValueOnly().");
@@ -2648,7 +2678,7 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
2648
2678
  const headerParameters = {};
2649
2679
  headerParameters["Content-Type"] = "application/json";
2650
2680
  return new VoidApiResponse(await this.request({
2651
- path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{aasIdentifier}`, encodeURIComponent(String(requestParameters["aasIdentifier"]))).replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
2681
+ path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
2652
2682
  method: "POST",
2653
2683
  headers: headerParameters,
2654
2684
  query: queryParameters,
@@ -2689,7 +2719,6 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
2689
2719
  * Synchronously invokes an Operation at a specified path
2690
2720
  */
2691
2721
  async invokeOperationValueOnlyRaw(requestParameters, initOverrides) {
2692
- if (requestParameters["aasIdentifier"] == null) throw new RequiredError("aasIdentifier", "Required parameter \"aasIdentifier\" was null or undefined when calling invokeOperationValueOnly().");
2693
2722
  if (requestParameters["submodelIdentifier"] == null) throw new RequiredError("submodelIdentifier", "Required parameter \"submodelIdentifier\" was null or undefined when calling invokeOperationValueOnly().");
2694
2723
  if (requestParameters["idShortPath"] == null) throw new RequiredError("idShortPath", "Required parameter \"idShortPath\" was null or undefined when calling invokeOperationValueOnly().");
2695
2724
  if (requestParameters["operationRequestValueOnly"] == null) throw new RequiredError("operationRequestValueOnly", "Required parameter \"operationRequestValueOnly\" was null or undefined when calling invokeOperationValueOnly().");
@@ -2697,7 +2726,7 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
2697
2726
  const headerParameters = {};
2698
2727
  headerParameters["Content-Type"] = "application/json";
2699
2728
  return new JSONApiResponse(await this.request({
2700
- path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{aasIdentifier}`, encodeURIComponent(String(requestParameters["aasIdentifier"]))).replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
2729
+ path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
2701
2730
  method: "POST",
2702
2731
  headers: headerParameters,
2703
2732
  query: queryParameters,
@@ -3013,6 +3042,29 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
3013
3042
  default: return await response.value();
3014
3043
  }
3015
3044
  }
3045
+ /**
3046
+ * Returns all Submodels that confirm to the input query
3047
+ */
3048
+ async querySubmodelsRaw(requestParameters, initOverrides) {
3049
+ const queryParameters = {};
3050
+ if (requestParameters["limit"] != null) queryParameters["limit"] = requestParameters["limit"];
3051
+ if (requestParameters["cursor"] != null) queryParameters["cursor"] = requestParameters["cursor"];
3052
+ const headerParameters = {};
3053
+ headerParameters["Content-Type"] = "application/json";
3054
+ return new JSONApiResponse(await this.request({
3055
+ path: `/query/submodels`,
3056
+ method: "POST",
3057
+ headers: headerParameters,
3058
+ query: queryParameters,
3059
+ body: requestParameters["query"]
3060
+ }, initOverrides));
3061
+ }
3062
+ /**
3063
+ * Returns all Submodels that confirm to the input query
3064
+ */
3065
+ async querySubmodels(requestParameters = {}, initOverrides) {
3066
+ return await (await this.querySubmodelsRaw(requestParameters, initOverrides)).value();
3067
+ }
3016
3068
  };
3017
3069
  /**
3018
3070
  * @export
@@ -3392,6 +3444,13 @@ const QualifierKind$2 = {
3392
3444
  ValueQualifier: "ValueQualifier"
3393
3445
  };
3394
3446
  /**
3447
+ * @export
3448
+ */
3449
+ const QueryResultSubmodelPagingMetadataResultTypeEnum = {
3450
+ Submodel: "Submodel",
3451
+ Identifier: "Identifier"
3452
+ };
3453
+ /**
3395
3454
  *
3396
3455
  * @export
3397
3456
  */
@@ -3451,6 +3510,7 @@ var SubmodelRepositoryService_exports = /* @__PURE__ */ __exportAll({
3451
3510
  PatchSubmodelElementByPathValueOnlySubmodelRepoLevelEnum: () => PatchSubmodelElementByPathValueOnlySubmodelRepoLevelEnum,
3452
3511
  PutSubmodelElementByPathSubmodelRepoLevelEnum: () => PutSubmodelElementByPathSubmodelRepoLevelEnum,
3453
3512
  QualifierKind: () => QualifierKind$2,
3513
+ QueryResultSubmodelPagingMetadataResultTypeEnum: () => QueryResultSubmodelPagingMetadataResultTypeEnum,
3454
3514
  ReferenceTypes: () => ReferenceTypes$5,
3455
3515
  SerializationAPIApi: () => SerializationAPIApi$1,
3456
3516
  StateOfEvent: () => StateOfEvent$2,
@@ -3582,6 +3642,29 @@ var ConceptDescriptionRepositoryAPIApi = class extends BaseAPI {
3582
3642
  default: return await response.value();
3583
3643
  }
3584
3644
  }
3645
+ /**
3646
+ * Returns all Concept Descriptions that confirm to the input query
3647
+ */
3648
+ async queryConceptDescriptionsRaw(requestParameters, initOverrides) {
3649
+ const queryParameters = {};
3650
+ if (requestParameters["limit"] != null) queryParameters["limit"] = requestParameters["limit"];
3651
+ if (requestParameters["cursor"] != null) queryParameters["cursor"] = requestParameters["cursor"];
3652
+ const headerParameters = {};
3653
+ headerParameters["Content-Type"] = "application/json";
3654
+ return new JSONApiResponse(await this.request({
3655
+ path: `/query/concept-descriptions`,
3656
+ method: "POST",
3657
+ headers: headerParameters,
3658
+ query: queryParameters,
3659
+ body: requestParameters["query"]
3660
+ }, initOverrides));
3661
+ }
3662
+ /**
3663
+ * Returns all Concept Descriptions that confirm to the input query
3664
+ */
3665
+ async queryConceptDescriptions(requestParameters = {}, initOverrides) {
3666
+ return await (await this.queryConceptDescriptionsRaw(requestParameters, initOverrides)).value();
3667
+ }
3585
3668
  };
3586
3669
  //#endregion
3587
3670
  //#region dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.js
@@ -3851,6 +3934,13 @@ const QualifierKind$1 = {
3851
3934
  ValueQualifier: "ValueQualifier"
3852
3935
  };
3853
3936
  /**
3937
+ * @export
3938
+ */
3939
+ const QueryResultConceptDescriptionPagingMetadataResultTypeEnum = {
3940
+ ConceptDescription: "ConceptDescription",
3941
+ Identifier: "Identifier"
3942
+ };
3943
+ /**
3854
3944
  *
3855
3945
  * @export
3856
3946
  */
@@ -3882,6 +3972,7 @@ var ConceptDescriptionRepositoryService_exports = /* @__PURE__ */ __exportAll({
3882
3972
  ModelType: () => ModelType$3,
3883
3973
  ModellingKind: () => ModellingKind$1,
3884
3974
  QualifierKind: () => QualifierKind$1,
3975
+ QueryResultConceptDescriptionPagingMetadataResultTypeEnum: () => QueryResultConceptDescriptionPagingMetadataResultTypeEnum,
3885
3976
  ReferenceTypes: () => ReferenceTypes$4,
3886
3977
  SerializationAPIApi: () => SerializationAPIApi,
3887
3978
  StateOfEvent: () => StateOfEvent$1
@@ -4122,6 +4213,29 @@ var AssetAdministrationShellRegistryAPIApi = class extends BaseAPI {
4122
4213
  default: return await response.value();
4123
4214
  }
4124
4215
  }
4216
+ /**
4217
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
4218
+ */
4219
+ async queryAssetAdministrationShellDescriptorsRaw(requestParameters, initOverrides) {
4220
+ const queryParameters = {};
4221
+ if (requestParameters["limit"] != null) queryParameters["limit"] = requestParameters["limit"];
4222
+ if (requestParameters["cursor"] != null) queryParameters["cursor"] = requestParameters["cursor"];
4223
+ const headerParameters = {};
4224
+ headerParameters["Content-Type"] = "application/json";
4225
+ return new JSONApiResponse(await this.request({
4226
+ path: `/query/shell-descriptors`,
4227
+ method: "POST",
4228
+ headers: headerParameters,
4229
+ query: queryParameters,
4230
+ body: requestParameters["query"]
4231
+ }, initOverrides));
4232
+ }
4233
+ /**
4234
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
4235
+ */
4236
+ async queryAssetAdministrationShellDescriptors(requestParameters = {}, initOverrides) {
4237
+ return await (await this.queryAssetAdministrationShellDescriptorsRaw(requestParameters, initOverrides)).value();
4238
+ }
4125
4239
  };
4126
4240
  //#endregion
4127
4241
  //#region dist/generated/AasRegistryService/apis/DescriptionAPIApi.js
@@ -4304,6 +4418,10 @@ const ProtocolInformationSecurityAttributesInnerTypeEnum = {
4304
4418
  W3CDid: "W3C_DID"
4305
4419
  };
4306
4420
  /**
4421
+ * @export
4422
+ */
4423
+ const QueryResultAssetAdministrationShellDescriptorPagingMetadataResultTypeEnum = { AssetAdministrationShellDescriptor: "AssetAdministrationShellDescriptor" };
4424
+ /**
4307
4425
  *
4308
4426
  * @export
4309
4427
  */
@@ -4331,6 +4449,7 @@ var AasRegistryService_exports = /* @__PURE__ */ __exportAll({
4331
4449
  MessageMessageTypeEnum: () => MessageMessageTypeEnum$3,
4332
4450
  ModelType: () => ModelType$2,
4333
4451
  ProtocolInformationSecurityAttributesInnerTypeEnum: () => ProtocolInformationSecurityAttributesInnerTypeEnum,
4452
+ QueryResultAssetAdministrationShellDescriptorPagingMetadataResultTypeEnum: () => QueryResultAssetAdministrationShellDescriptorPagingMetadataResultTypeEnum,
4334
4453
  ReferenceTypes: () => ReferenceTypes$3,
4335
4454
  RequiredError: () => RequiredError,
4336
4455
  ResponseError: () => ResponseError,
@@ -4498,6 +4617,29 @@ var SubmodelRegistryAPIApi = class extends BaseAPI {
4498
4617
  default: return await response.value();
4499
4618
  }
4500
4619
  }
4620
+ /**
4621
+ * Returns all Submodel Descriptors that confirm to the input query
4622
+ */
4623
+ async querySubmodelDescriptorsRaw(requestParameters, initOverrides) {
4624
+ const queryParameters = {};
4625
+ if (requestParameters["limit"] != null) queryParameters["limit"] = requestParameters["limit"];
4626
+ if (requestParameters["cursor"] != null) queryParameters["cursor"] = requestParameters["cursor"];
4627
+ const headerParameters = {};
4628
+ headerParameters["Content-Type"] = "application/json";
4629
+ return new JSONApiResponse(await this.request({
4630
+ path: `/query/submodel-descriptors`,
4631
+ method: "POST",
4632
+ headers: headerParameters,
4633
+ query: queryParameters,
4634
+ body: requestParameters["query"]
4635
+ }, initOverrides));
4636
+ }
4637
+ /**
4638
+ * Returns all Submodel Descriptors that confirm to the input query
4639
+ */
4640
+ async querySubmodelDescriptors(requestParameters = {}, initOverrides) {
4641
+ return await (await this.querySubmodelDescriptorsRaw(requestParameters, initOverrides)).value();
4642
+ }
4501
4643
  };
4502
4644
  //#endregion
4503
4645
  //#region dist/generated/SubmodelRegistryService/models/index.js
@@ -4635,6 +4777,13 @@ const ProtocolInformationSecurityAttributesTypeEnum$1 = {
4635
4777
  W3CDid: "W3C_DID"
4636
4778
  };
4637
4779
  /**
4780
+ * @export
4781
+ */
4782
+ const QueryResultSubmodelDescriptorPagingMetadataResultTypeEnum = {
4783
+ SubmodelDescriptor: "SubmodelDescriptor",
4784
+ Identifier: "Identifier"
4785
+ };
4786
+ /**
4638
4787
  *
4639
4788
  * @export
4640
4789
  */
@@ -4652,6 +4801,7 @@ var SubmodelRegistryService_exports = /* @__PURE__ */ __exportAll({
4652
4801
  MessageMessageTypeEnum: () => MessageMessageTypeEnum$2,
4653
4802
  ModelType: () => ModelType$1,
4654
4803
  ProtocolInformationSecurityAttributesTypeEnum: () => ProtocolInformationSecurityAttributesTypeEnum$1,
4804
+ QueryResultSubmodelDescriptorPagingMetadataResultTypeEnum: () => QueryResultSubmodelDescriptorPagingMetadataResultTypeEnum,
4655
4805
  ReferenceTypes: () => ReferenceTypes$2,
4656
4806
  SubmodelRegistryAPIApi: () => SubmodelRegistryAPIApi
4657
4807
  });
@@ -26513,6 +26663,723 @@ function convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor
26513
26663
  return JSON.parse(submodelDescriptorStr);
26514
26664
  }
26515
26665
  //#endregion
26666
+ //#region dist/models/Query.js
26667
+ /**
26668
+ * Model of the AAS Query Language (IDTA-01002-3, `$condition`, `$filters` and `$select`).
26669
+ *
26670
+ * The names, property order and constructor signatures follow the query region of the aas-core-meta V3.2 meta-model,
26671
+ * so that this model can be replaced by the classes aas-core-codegen generates for it. Properties carry the
26672
+ * meta-model names (e.g. `strVal`, `andOperands`); {@link toJsonableQuery} and {@link queryFromJsonable} map them to the
26673
+ * JSON names of the query language (e.g. `$strVal`, `$and`).
26674
+ *
26675
+ * See https://industrialdigitaltwin.io/aas-specifications/IDTA-01002/v3.2/query-language.html
26676
+ */
26677
+ /**
26678
+ * Enumerate the global attributes which can be used in a query.
26679
+ */
26680
+ var GlobalAttributeKind;
26681
+ (function(GlobalAttributeKind) {
26682
+ /** The current date and time in the local time zone of the server (`LOCALNOW`) */
26683
+ GlobalAttributeKind[GlobalAttributeKind["LocalNow"] = 0] = "LocalNow";
26684
+ /** The current date and time in UTC (`UTCNOW`) */
26685
+ GlobalAttributeKind[GlobalAttributeKind["UtcNow"] = 1] = "UtcNow";
26686
+ /** The current date and time of the client (`CLIENTNOW`) */
26687
+ GlobalAttributeKind[GlobalAttributeKind["ClientNow"] = 2] = "ClientNow";
26688
+ /** The anonymous user, i.e. a request without authentication (`ANONYMOUS`) */
26689
+ GlobalAttributeKind[GlobalAttributeKind["Anonymous"] = 3] = "Anonymous";
26690
+ })(GlobalAttributeKind || (GlobalAttributeKind = {}));
26691
+ /**
26692
+ * Enumerate the global attributes which can be used as a date-time operand in a query.
26693
+ *
26694
+ * This is a subset of {@link GlobalAttributeKind}.
26695
+ */
26696
+ var DateTimeGlobalAttributeKind;
26697
+ (function(DateTimeGlobalAttributeKind) {
26698
+ /** The current date and time in the local time zone of the server (`LOCALNOW`) */
26699
+ DateTimeGlobalAttributeKind[DateTimeGlobalAttributeKind["LocalNow"] = 0] = "LocalNow";
26700
+ /** The current date and time in UTC (`UTCNOW`) */
26701
+ DateTimeGlobalAttributeKind[DateTimeGlobalAttributeKind["UtcNow"] = 1] = "UtcNow";
26702
+ /** The current date and time of the client (`CLIENTNOW`) */
26703
+ DateTimeGlobalAttributeKind[DateTimeGlobalAttributeKind["ClientNow"] = 2] = "ClientNow";
26704
+ })(DateTimeGlobalAttributeKind || (DateTimeGlobalAttributeKind = {}));
26705
+ /**
26706
+ * Enumerate what a query returns instead of the full objects.
26707
+ */
26708
+ var QuerySelect;
26709
+ (function(QuerySelect) {
26710
+ /** Return only the identifiers of the matching objects (`id`) */
26711
+ QuerySelect[QuerySelect["Id"] = 0] = "Id";
26712
+ })(QuerySelect || (QuerySelect = {}));
26713
+ /**
26714
+ * Refer to a claim of the requester, e.g. from an access token (`CLAIM`).
26715
+ */
26716
+ var ClaimAttribute = class {
26717
+ claim;
26718
+ constructor(claim) {
26719
+ this.claim = claim;
26720
+ }
26721
+ };
26722
+ /**
26723
+ * Refer to a global attribute (`GLOBAL`).
26724
+ */
26725
+ var GlobalAttribute = class {
26726
+ kind;
26727
+ constructor(kind) {
26728
+ this.kind = kind;
26729
+ }
26730
+ };
26731
+ /**
26732
+ * Refer to an attribute of a referable (`REFERENCE`).
26733
+ */
26734
+ var ReferenceAttribute = class {
26735
+ reference;
26736
+ constructor(reference) {
26737
+ this.reference = reference;
26738
+ }
26739
+ };
26740
+ /**
26741
+ * Refer to a global attribute which gives a date and time (`GLOBAL`).
26742
+ */
26743
+ var DateTimeAttributeItem = class {
26744
+ kind;
26745
+ constructor(kind) {
26746
+ this.kind = kind;
26747
+ }
26748
+ };
26749
+ /**
26750
+ * Refer to a field of the queried data (`$field`), e.g. `$aas#idShort` or `$sme.Temperature#value`.
26751
+ */
26752
+ var FieldOperand = class {
26753
+ field;
26754
+ constructor(field) {
26755
+ this.field = field;
26756
+ }
26757
+ };
26758
+ /**
26759
+ * Represent a string literal (`$strVal`).
26760
+ */
26761
+ var StringLiteral = class {
26762
+ strVal;
26763
+ constructor(strVal) {
26764
+ this.strVal = strVal;
26765
+ }
26766
+ };
26767
+ /**
26768
+ * Use an attribute as an operand (`$attribute`).
26769
+ */
26770
+ var AttributeOperand = class {
26771
+ attribute;
26772
+ constructor(attribute) {
26773
+ this.attribute = attribute;
26774
+ }
26775
+ };
26776
+ /**
26777
+ * Represent a number literal (`$numVal`).
26778
+ */
26779
+ var NumberLiteral = class {
26780
+ numVal;
26781
+ constructor(numVal) {
26782
+ this.numVal = numVal;
26783
+ }
26784
+ };
26785
+ /**
26786
+ * Represent a hexadecimal literal (`$hexVal`), e.g. `16#1F`.
26787
+ */
26788
+ var HexLiteral = class {
26789
+ hexVal;
26790
+ constructor(hexVal) {
26791
+ this.hexVal = hexVal;
26792
+ }
26793
+ };
26794
+ /**
26795
+ * Represent a date-time literal (`$dateTimeVal`), e.g. `2025-01-01T00:00:00Z`.
26796
+ */
26797
+ var DateTimeLiteral = class {
26798
+ dateTimeVal;
26799
+ constructor(dateTimeVal) {
26800
+ this.dateTimeVal = dateTimeVal;
26801
+ }
26802
+ };
26803
+ /**
26804
+ * Represent a time literal (`$timeVal`), e.g. `12:00` or `12:00:00`.
26805
+ */
26806
+ var TimeLiteral = class {
26807
+ timeVal;
26808
+ constructor(timeVal) {
26809
+ this.timeVal = timeVal;
26810
+ }
26811
+ };
26812
+ /**
26813
+ * Represent a boolean literal (`$boolean`). It is both an operand and a logical expression.
26814
+ */
26815
+ var BooleanLiteral = class {
26816
+ boolean;
26817
+ constructor(boolean) {
26818
+ this.boolean = boolean;
26819
+ }
26820
+ };
26821
+ /**
26822
+ * Cast the operand to a string (`$strCast`).
26823
+ */
26824
+ var StringCast = class {
26825
+ strCast;
26826
+ constructor(strCast) {
26827
+ this.strCast = strCast;
26828
+ }
26829
+ };
26830
+ /**
26831
+ * Cast the operand to a number (`$numCast`).
26832
+ */
26833
+ var NumberCast = class {
26834
+ numCast;
26835
+ constructor(numCast) {
26836
+ this.numCast = numCast;
26837
+ }
26838
+ };
26839
+ /**
26840
+ * Cast the operand to a hexadecimal (`$hexCast`).
26841
+ */
26842
+ var HexCast = class {
26843
+ hexCast;
26844
+ constructor(hexCast) {
26845
+ this.hexCast = hexCast;
26846
+ }
26847
+ };
26848
+ /**
26849
+ * Cast the operand to a boolean (`$boolCast`).
26850
+ */
26851
+ var BooleanCast = class {
26852
+ boolCast;
26853
+ constructor(boolCast) {
26854
+ this.boolCast = boolCast;
26855
+ }
26856
+ };
26857
+ /**
26858
+ * Cast the operand to a date-time (`$dateTimeCast`).
26859
+ */
26860
+ var DateTimeCast = class {
26861
+ dateTimeCast;
26862
+ constructor(dateTimeCast) {
26863
+ this.dateTimeCast = dateTimeCast;
26864
+ }
26865
+ };
26866
+ /**
26867
+ * Cast the operand to a time (`$timeCast`).
26868
+ */
26869
+ var TimeCast = class {
26870
+ timeCast;
26871
+ constructor(timeCast) {
26872
+ this.timeCast = timeCast;
26873
+ }
26874
+ };
26875
+ /**
26876
+ * Extract the day of the week from a date-time (`$dayOfWeek`).
26877
+ */
26878
+ var DayOfWeek = class {
26879
+ dayOfWeek;
26880
+ constructor(dayOfWeek) {
26881
+ this.dayOfWeek = dayOfWeek;
26882
+ }
26883
+ };
26884
+ /**
26885
+ * Extract the day of the month from a date-time (`$dayOfMonth`).
26886
+ */
26887
+ var DayOfMonth = class {
26888
+ dayOfMonth;
26889
+ constructor(dayOfMonth) {
26890
+ this.dayOfMonth = dayOfMonth;
26891
+ }
26892
+ };
26893
+ /**
26894
+ * Extract the month from a date-time (`$month`).
26895
+ */
26896
+ var Month = class {
26897
+ month;
26898
+ constructor(month) {
26899
+ this.month = month;
26900
+ }
26901
+ };
26902
+ /**
26903
+ * Extract the year from a date-time (`$year`).
26904
+ */
26905
+ var Year = class {
26906
+ year;
26907
+ constructor(year) {
26908
+ this.year = year;
26909
+ }
26910
+ };
26911
+ /**
26912
+ * Use a date-time global attribute as an operand (`$attribute`).
26913
+ */
26914
+ var DateTimeAttributeOperand = class {
26915
+ attribute;
26916
+ constructor(attribute) {
26917
+ this.attribute = attribute;
26918
+ }
26919
+ };
26920
+ /**
26921
+ * Check whether the two operands are equal (`$eq`).
26922
+ */
26923
+ var EqualComparison = class {
26924
+ eq;
26925
+ constructor(eq) {
26926
+ this.eq = eq;
26927
+ }
26928
+ };
26929
+ /**
26930
+ * Check whether the two operands are not equal (`$ne`).
26931
+ */
26932
+ var NotEqualComparison = class {
26933
+ ne;
26934
+ constructor(ne) {
26935
+ this.ne = ne;
26936
+ }
26937
+ };
26938
+ /**
26939
+ * Check whether the first operand is greater than the second (`$gt`).
26940
+ */
26941
+ var GreaterThanComparison = class {
26942
+ gt;
26943
+ constructor(gt) {
26944
+ this.gt = gt;
26945
+ }
26946
+ };
26947
+ /**
26948
+ * Check whether the first operand is greater than or equal to the second (`$ge`).
26949
+ */
26950
+ var GreaterThanOrEqualComparison = class {
26951
+ ge;
26952
+ constructor(ge) {
26953
+ this.ge = ge;
26954
+ }
26955
+ };
26956
+ /**
26957
+ * Check whether the first operand is less than the second (`$lt`).
26958
+ */
26959
+ var LessThanComparison = class {
26960
+ lt;
26961
+ constructor(lt) {
26962
+ this.lt = lt;
26963
+ }
26964
+ };
26965
+ /**
26966
+ * Check whether the first operand is less than or equal to the second (`$le`).
26967
+ */
26968
+ var LessThanOrEqualComparison = class {
26969
+ le;
26970
+ constructor(le) {
26971
+ this.le = le;
26972
+ }
26973
+ };
26974
+ /**
26975
+ * Check whether the first operand contains the second (`$contains`).
26976
+ */
26977
+ var ContainsComparison = class {
26978
+ contains;
26979
+ constructor(contains) {
26980
+ this.contains = contains;
26981
+ }
26982
+ };
26983
+ /**
26984
+ * Check whether the first operand starts with the second (`$starts-with`).
26985
+ */
26986
+ var StartsWithComparison = class {
26987
+ startsWith;
26988
+ constructor(startsWith) {
26989
+ this.startsWith = startsWith;
26990
+ }
26991
+ };
26992
+ /**
26993
+ * Check whether the first operand ends with the second (`$ends-with`).
26994
+ */
26995
+ var EndsWithComparison = class {
26996
+ endsWith;
26997
+ constructor(endsWith) {
26998
+ this.endsWith = endsWith;
26999
+ }
27000
+ };
27001
+ /**
27002
+ * Check whether the first operand matches the regular expression given by the second (`$regex`).
27003
+ */
27004
+ var RegexComparison = class {
27005
+ regex;
27006
+ constructor(regex) {
27007
+ this.regex = regex;
27008
+ }
27009
+ };
27010
+ /**
27011
+ * Evaluate all the expressions against the same element of a list (`$match`), at least one.
27012
+ */
27013
+ var MatchClause = class {
27014
+ matchOperands;
27015
+ constructor(matchOperands) {
27016
+ this.matchOperands = matchOperands;
27017
+ }
27018
+ };
27019
+ /**
27020
+ * Check whether all the operands hold (`$and`), at least two.
27021
+ */
27022
+ var AndExpression = class {
27023
+ andOperands;
27024
+ constructor(andOperands) {
27025
+ this.andOperands = andOperands;
27026
+ }
27027
+ };
27028
+ /**
27029
+ * Check whether any of the operands holds (`$or`), at least two.
27030
+ */
27031
+ var OrExpression = class {
27032
+ orOperands;
27033
+ constructor(orOperands) {
27034
+ this.orOperands = orOperands;
27035
+ }
27036
+ };
27037
+ /**
27038
+ * Negate the operand (`$not`).
27039
+ */
27040
+ var NotExpression = class {
27041
+ notOperand;
27042
+ constructor(notOperand) {
27043
+ this.notOperand = notOperand;
27044
+ }
27045
+ };
27046
+ /**
27047
+ * Filter a fragment of the returned data by a condition (an entry of `$filters`).
27048
+ */
27049
+ var QueryFilter = class {
27050
+ fragment;
27051
+ condition;
27052
+ constructor(fragment, condition) {
27053
+ this.fragment = fragment;
27054
+ this.condition = condition;
27055
+ }
27056
+ };
27057
+ /**
27058
+ * A query in the AAS Query Language.
27059
+ *
27060
+ * @example
27061
+ * ```typescript
27062
+ * const query = new Query(
27063
+ * new EqualComparison([new FieldOperand('$aas#idShort'), new StringLiteral('Robot')])
27064
+ * );
27065
+ * ```
27066
+ */
27067
+ var Query = class {
27068
+ condition;
27069
+ select;
27070
+ filters;
27071
+ constructor(condition, select = null, filters = null) {
27072
+ this.condition = condition;
27073
+ this.select = select;
27074
+ this.filters = filters;
27075
+ }
27076
+ };
27077
+ //#endregion
27078
+ //#region dist/lib/queryJsonization.js
27079
+ const GLOBAL_ATTRIBUTE_KIND_JSON_NAMES = [
27080
+ "LOCALNOW",
27081
+ "UTCNOW",
27082
+ "CLIENTNOW",
27083
+ "ANONYMOUS"
27084
+ ];
27085
+ const QUERY_SELECT_JSON_NAMES = ["id"];
27086
+ const PROPERTY_JSON_NAMES = [
27087
+ ["claim", "CLAIM"],
27088
+ ["kind", "GLOBAL"],
27089
+ ["reference", "REFERENCE"],
27090
+ ["field", "$field"],
27091
+ ["strVal", "$strVal"],
27092
+ ["attribute", "$attribute"],
27093
+ ["numVal", "$numVal"],
27094
+ ["hexVal", "$hexVal"],
27095
+ ["dateTimeVal", "$dateTimeVal"],
27096
+ ["timeVal", "$timeVal"],
27097
+ ["boolean", "$boolean"],
27098
+ ["strCast", "$strCast"],
27099
+ ["numCast", "$numCast"],
27100
+ ["hexCast", "$hexCast"],
27101
+ ["boolCast", "$boolCast"],
27102
+ ["dateTimeCast", "$dateTimeCast"],
27103
+ ["timeCast", "$timeCast"],
27104
+ ["dayOfWeek", "$dayOfWeek"],
27105
+ ["dayOfMonth", "$dayOfMonth"],
27106
+ ["month", "$month"],
27107
+ ["year", "$year"],
27108
+ ["eq", "$eq"],
27109
+ ["ne", "$ne"],
27110
+ ["gt", "$gt"],
27111
+ ["ge", "$ge"],
27112
+ ["lt", "$lt"],
27113
+ ["le", "$le"],
27114
+ ["contains", "$contains"],
27115
+ ["startsWith", "$starts-with"],
27116
+ ["endsWith", "$ends-with"],
27117
+ ["regex", "$regex"],
27118
+ ["matchOperands", "$match"],
27119
+ ["andOperands", "$and"],
27120
+ ["orOperands", "$or"],
27121
+ ["notOperand", "$not"]
27122
+ ];
27123
+ /**
27124
+ * Serialize a query to the JSON of the AAS Query Language, as sent in the body of the `/query/*` endpoints.
27125
+ *
27126
+ * @param query The query to serialize
27127
+ * @returns The JSON-able object, e.g. `{ "$condition": { "$eq": [{ "$field": "$aas#idShort" }, { "$strVal": "x" }] } }`
27128
+ */
27129
+ function toJsonableQuery(query) {
27130
+ const jsonable = {};
27131
+ if (query.select !== null && query.select !== void 0) jsonable["$select"] = enumToJsonable(QUERY_SELECT_JSON_NAMES, query.select, "QuerySelect");
27132
+ jsonable["$condition"] = expressionToJsonable(query.condition);
27133
+ if (query.filters !== null && query.filters !== void 0) jsonable["$filters"] = query.filters.map((filter) => ({
27134
+ $fragment: filter.fragment,
27135
+ $condition: expressionToJsonable(filter.condition)
27136
+ }));
27137
+ return jsonable;
27138
+ }
27139
+ function expressionToJsonable(expression) {
27140
+ const properties = expression;
27141
+ for (const [property, jsonName] of PROPERTY_JSON_NAMES) {
27142
+ const value = properties?.[property];
27143
+ if (value !== void 0) return { [jsonName]: propertyToJsonable(property, value) };
27144
+ }
27145
+ throw new Error(`Unexpected query expression: ${JSON.stringify(expression)}`);
27146
+ }
27147
+ function propertyToJsonable(property, value) {
27148
+ if (property === "kind") return enumToJsonable(GLOBAL_ATTRIBUTE_KIND_JSON_NAMES, value, "GlobalAttributeKind");
27149
+ if (Array.isArray(value)) return value.map((item) => expressionToJsonable(item));
27150
+ if (typeof value === "object" && value !== null) return expressionToJsonable(value);
27151
+ return value;
27152
+ }
27153
+ function enumToJsonable(jsonNames, value, enumName) {
27154
+ const jsonName = jsonNames[value];
27155
+ if (jsonName === void 0) throw new Error(`Unexpected ${enumName} value: ${value}`);
27156
+ return jsonName;
27157
+ }
27158
+ /**
27159
+ * Parse the JSON of the AAS Query Language as a {@link Query}.
27160
+ *
27161
+ * @param jsonable The JSON-able value to parse, e.g. the result of `JSON.parse`
27162
+ * @returns Either the parsed query, or the error with the path to the invalid value
27163
+ */
27164
+ function queryFromJsonable(jsonable) {
27165
+ try {
27166
+ return new Either(parseQuery(jsonable), null);
27167
+ } catch (err) {
27168
+ if (err instanceof ParseError) return new Either(null, new DeserializationError(err.message, err.path));
27169
+ throw err;
27170
+ }
27171
+ }
27172
+ var ParseError = class {
27173
+ message;
27174
+ path = new Path$1();
27175
+ constructor(message) {
27176
+ this.message = message;
27177
+ }
27178
+ };
27179
+ function fail(message) {
27180
+ throw new ParseError(message);
27181
+ }
27182
+ function describeJsonValue(jsonable) {
27183
+ if (jsonable === null) return "null";
27184
+ if (Array.isArray(jsonable)) return "an array";
27185
+ return typeof jsonable;
27186
+ }
27187
+ function asObject(jsonable) {
27188
+ if (typeof jsonable !== "object" || jsonable === null || Array.isArray(jsonable)) fail(`Expected a JSON object, but got ${describeJsonValue(jsonable)}`);
27189
+ return jsonable;
27190
+ }
27191
+ function asString(jsonable) {
27192
+ if (typeof jsonable !== "string") fail(`Expected a string, but got ${describeJsonValue(jsonable)}`);
27193
+ return jsonable;
27194
+ }
27195
+ function asNumber(jsonable) {
27196
+ if (typeof jsonable !== "number") fail(`Expected a number, but got ${describeJsonValue(jsonable)}`);
27197
+ return jsonable;
27198
+ }
27199
+ function asBoolean(jsonable) {
27200
+ if (typeof jsonable !== "boolean") fail(`Expected a boolean, but got ${describeJsonValue(jsonable)}`);
27201
+ return jsonable;
27202
+ }
27203
+ function asArray(jsonable) {
27204
+ if (!Array.isArray(jsonable)) fail(`Expected an array, but got ${describeJsonValue(jsonable)}`);
27205
+ return jsonable;
27206
+ }
27207
+ function listOf(parse) {
27208
+ return (jsonable) => {
27209
+ const items = asArray(jsonable);
27210
+ return items.map((item, index) => {
27211
+ try {
27212
+ return parse(item);
27213
+ } catch (err) {
27214
+ if (err instanceof ParseError) err.path.prepend(new IndexSegment$1(items, index));
27215
+ throw err;
27216
+ }
27217
+ });
27218
+ };
27219
+ }
27220
+ function pairOf(parse) {
27221
+ return (jsonable) => {
27222
+ const items = asArray(jsonable);
27223
+ if (items.length !== 2) fail(`Expected exactly two operands, but got ${items.length}`);
27224
+ const [left, right] = listOf(parse)(items);
27225
+ return [left, right];
27226
+ };
27227
+ }
27228
+ function enumFromJsonable(jsonNames, enumName) {
27229
+ return (jsonable) => {
27230
+ const value = jsonNames.indexOf(asString(jsonable));
27231
+ if (value === -1) fail(`Expected a ${enumName} (${jsonNames.join(", ")}), but got ${JSON.stringify(jsonable)}`);
27232
+ return value;
27233
+ };
27234
+ }
27235
+ function property(jsonObject, name, parse) {
27236
+ try {
27237
+ if (jsonObject[name] === void 0) fail(`The required property is missing`);
27238
+ return parse(jsonObject[name]);
27239
+ } catch (err) {
27240
+ if (err instanceof ParseError) err.path.prepend(new PropertySegment$1(jsonObject, name));
27241
+ throw err;
27242
+ }
27243
+ }
27244
+ function expectOnlyProperties(jsonObject, names, typeName) {
27245
+ const unexpected = Object.keys(jsonObject).filter((key) => !names.includes(key));
27246
+ if (unexpected.length > 0) fail(`Unexpected properties for ${typeName}: ${unexpected.join(", ")}`);
27247
+ }
27248
+ /**
27249
+ * Parse an expression of a union by the one property that names its class, as the JSON of the query language has no
27250
+ * `modelType`.
27251
+ */
27252
+ function oneOf(typeName, parsers) {
27253
+ return (jsonable) => {
27254
+ const jsonObject = asObject(jsonable);
27255
+ const available = parsers();
27256
+ const names = Object.keys(jsonObject);
27257
+ if (names.length !== 1 || !Object.hasOwn(available, names[0])) fail(`Expected exactly one of the properties ${Object.keys(available).join(", ")} for ${typeName}, but got: ${names.join(", ") || "none"}`);
27258
+ return available[names[0]](jsonObject);
27259
+ };
27260
+ }
27261
+ const parseGlobalAttributeKind = enumFromJsonable(GLOBAL_ATTRIBUTE_KIND_JSON_NAMES, "GlobalAttributeKind");
27262
+ const parseDateTimeGlobalAttributeKind = enumFromJsonable(GLOBAL_ATTRIBUTE_KIND_JSON_NAMES.slice(0, 3), "DateTimeGlobalAttributeKind");
27263
+ const parseQuerySelect = enumFromJsonable(QUERY_SELECT_JSON_NAMES, "QuerySelect");
27264
+ const parseAttributeItem = oneOf("AttributeItem", () => ({
27265
+ CLAIM: (o) => new ClaimAttribute(property(o, "CLAIM", asString)),
27266
+ GLOBAL: (o) => new GlobalAttribute(property(o, "GLOBAL", parseGlobalAttributeKind)),
27267
+ REFERENCE: (o) => new ReferenceAttribute(property(o, "REFERENCE", asString))
27268
+ }));
27269
+ const parseDateTimeAttributeItem = oneOf("DateTimeAttributeItem", () => ({ GLOBAL: (o) => new DateTimeAttributeItem(property(o, "GLOBAL", parseDateTimeGlobalAttributeKind)) }));
27270
+ const stringValueParsers = () => ({
27271
+ $field: (o) => new FieldOperand(property(o, "$field", asString)),
27272
+ $strVal: (o) => new StringLiteral(property(o, "$strVal", asString)),
27273
+ $strCast: (o) => new StringCast(property(o, "$strCast", parseValue)),
27274
+ $attribute: (o) => new AttributeOperand(property(o, "$attribute", parseAttributeItem))
27275
+ });
27276
+ const dateTimeLiteralParsers = () => ({
27277
+ $dateTimeVal: (o) => new DateTimeLiteral(property(o, "$dateTimeVal", asString)),
27278
+ $dateTimeCast: (o) => new DateTimeCast(property(o, "$dateTimeCast", parseStringValue))
27279
+ });
27280
+ const parseStringValue = oneOf("StringValue", stringValueParsers);
27281
+ const parseDateTimeOperand = oneOf("DateTimeOperand", () => ({
27282
+ ...dateTimeLiteralParsers(),
27283
+ $attribute: (o) => new DateTimeAttributeOperand(property(o, "$attribute", parseDateTimeAttributeItem))
27284
+ }));
27285
+ const parseTimeCastOperand = oneOf("TimeCastOperand", () => ({
27286
+ ...stringValueParsers(),
27287
+ ...dateTimeLiteralParsers()
27288
+ }));
27289
+ const parseValue = oneOf("Value", () => ({
27290
+ ...stringValueParsers(),
27291
+ $numVal: (o) => new NumberLiteral(property(o, "$numVal", asNumber)),
27292
+ $numCast: (o) => new NumberCast(property(o, "$numCast", parseValue)),
27293
+ $dayOfWeek: (o) => new DayOfWeek(property(o, "$dayOfWeek", parseDateTimeOperand)),
27294
+ $dayOfMonth: (o) => new DayOfMonth(property(o, "$dayOfMonth", parseDateTimeOperand)),
27295
+ $month: (o) => new Month(property(o, "$month", parseDateTimeOperand)),
27296
+ $year: (o) => new Year(property(o, "$year", parseDateTimeOperand)),
27297
+ $hexVal: (o) => new HexLiteral(property(o, "$hexVal", asString)),
27298
+ $hexCast: (o) => new HexCast(property(o, "$hexCast", parseValue)),
27299
+ $boolean: (o) => new BooleanLiteral(property(o, "$boolean", asBoolean)),
27300
+ $boolCast: (o) => new BooleanCast(property(o, "$boolCast", parseValue)),
27301
+ ...dateTimeLiteralParsers(),
27302
+ $timeVal: (o) => new TimeLiteral(property(o, "$timeVal", asString)),
27303
+ $timeCast: (o) => new TimeCast(property(o, "$timeCast", parseTimeCastOperand))
27304
+ }));
27305
+ const matchExpressionParsers = () => ({
27306
+ $match: (o) => new MatchClause(property(o, "$match", listOf(parseMatchExpression))),
27307
+ $eq: (o) => new EqualComparison(property(o, "$eq", pairOf(parseValue))),
27308
+ $ne: (o) => new NotEqualComparison(property(o, "$ne", pairOf(parseValue))),
27309
+ $gt: (o) => new GreaterThanComparison(property(o, "$gt", pairOf(parseValue))),
27310
+ $ge: (o) => new GreaterThanOrEqualComparison(property(o, "$ge", pairOf(parseValue))),
27311
+ $lt: (o) => new LessThanComparison(property(o, "$lt", pairOf(parseValue))),
27312
+ $le: (o) => new LessThanOrEqualComparison(property(o, "$le", pairOf(parseValue))),
27313
+ $contains: (o) => new ContainsComparison(property(o, "$contains", pairOf(parseStringValue))),
27314
+ "$starts-with": (o) => new StartsWithComparison(property(o, "$starts-with", pairOf(parseStringValue))),
27315
+ "$ends-with": (o) => new EndsWithComparison(property(o, "$ends-with", pairOf(parseStringValue))),
27316
+ $regex: (o) => new RegexComparison(property(o, "$regex", pairOf(parseStringValue)))
27317
+ });
27318
+ const parseMatchExpression = oneOf("MatchExpression", matchExpressionParsers);
27319
+ const parseLogicalExpression = oneOf("LogicalExpression", () => ({
27320
+ $and: (o) => new AndExpression(property(o, "$and", listOf(parseLogicalExpression))),
27321
+ $or: (o) => new OrExpression(property(o, "$or", listOf(parseLogicalExpression))),
27322
+ $not: (o) => new NotExpression(property(o, "$not", parseLogicalExpression)),
27323
+ $boolean: (o) => new BooleanLiteral(property(o, "$boolean", asBoolean)),
27324
+ ...matchExpressionParsers()
27325
+ }));
27326
+ function parseQueryFilter(jsonable) {
27327
+ const jsonObject = asObject(jsonable);
27328
+ expectOnlyProperties(jsonObject, ["$fragment", "$condition"], "QueryFilter");
27329
+ return new QueryFilter(property(jsonObject, "$fragment", asString), property(jsonObject, "$condition", parseLogicalExpression));
27330
+ }
27331
+ function parseQuery(jsonable) {
27332
+ const jsonObject = asObject(jsonable);
27333
+ expectOnlyProperties(jsonObject, [
27334
+ "$select",
27335
+ "$condition",
27336
+ "$filters"
27337
+ ], "Query");
27338
+ return new Query(property(jsonObject, "$condition", parseLogicalExpression), jsonObject["$select"] === void 0 ? null : property(jsonObject, "$select", parseQuerySelect), jsonObject["$filters"] === void 0 ? null : property(jsonObject, "$filters", listOf(parseQueryFilter)));
27339
+ }
27340
+ //#endregion
27341
+ //#region dist/lib/queryRequests.js
27342
+ /**
27343
+ * Serialize the query for the body of a `/query/*` request.
27344
+ *
27345
+ * @throws RequiredError if no query is given
27346
+ */
27347
+ function toQueryRequestBody(query) {
27348
+ if (query === null || query === void 0) throw new RequiredError("query", "Required parameter \"query\" was null or undefined.");
27349
+ return toJsonableQuery(query);
27350
+ }
27351
+ /**
27352
+ * Convert the response of a `/query/*` request.
27353
+ *
27354
+ * The result holds identifiers if the server reports `resultType: 'Identifier'` or the query selected them. Servers
27355
+ * that return objects for `select: QuerySelect.Id` anyway are tolerated: the `id` of each object is used.
27356
+ *
27357
+ * @param response The parsed response body
27358
+ * @param query The query that was sent
27359
+ * @param resultType The `resultType` of a result with objects
27360
+ * @param convertItem Converts a returned object
27361
+ */
27362
+ function convertQueryResult(response, query, resultType, convertItem) {
27363
+ const pagedResult = response.paging_metadata;
27364
+ const items = response.result ?? [];
27365
+ if (pagedResult?.resultType === "Identifier" || query.select === QuerySelect.Id) return {
27366
+ pagedResult,
27367
+ resultType: "Identifier",
27368
+ result: items.map(toIdentifier)
27369
+ };
27370
+ return {
27371
+ pagedResult,
27372
+ resultType,
27373
+ result: items.map((item) => convertItem(item))
27374
+ };
27375
+ }
27376
+ function toIdentifier(item) {
27377
+ if (typeof item === "string") return item;
27378
+ const id = item?.id;
27379
+ if (typeof id === "string") return id;
27380
+ throw new Error(`Expected an identifier in the query result, but got: ${JSON.stringify(item)}`);
27381
+ }
27382
+ //#endregion
26516
27383
  //#region dist/clients/AasRegistryClient.js
26517
27384
  var AasRegistryClient = class AasRegistryClient {
26518
27385
  static requireIdentifier(value, field) {
@@ -26573,6 +27440,42 @@ var AasRegistryClient = class AasRegistryClient {
26573
27440
  }
26574
27441
  }
26575
27442
  /**
27443
+ * Returns all Asset Administration Shell Descriptors that conform to the query (AAS Query Language)
27444
+ *
27445
+ * @param options Object containing:
27446
+ * - configuration: The http request options
27447
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aasdesc#idShort'), new StringLiteral('Robot')]))`
27448
+ * - limit?: The maximum number of elements in the response array
27449
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
27450
+ *
27451
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
27452
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
27453
+ */
27454
+ async queryAssetAdministrationShellDescriptors(options) {
27455
+ const { configuration, query, limit, cursor } = options;
27456
+ try {
27457
+ const response = await new AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration)).queryAssetAdministrationShellDescriptorsRaw({
27458
+ query: toQueryRequestBody(query),
27459
+ limit,
27460
+ cursor
27461
+ });
27462
+ return {
27463
+ success: true,
27464
+ data: convertQueryResult(await response.value(), query, "AssetAdministrationShellDescriptor", convertApiAasDescriptorToCoreAasDescriptor),
27465
+ statusCode: response.raw.status,
27466
+ etag: getEtag(response.raw)
27467
+ };
27468
+ } catch (err) {
27469
+ const customError = await handleApiError(err);
27470
+ return {
27471
+ success: false,
27472
+ error: customError,
27473
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
27474
+ ...getConditionalErrorFields(err)
27475
+ };
27476
+ }
27477
+ }
27478
+ /**
26576
27479
  * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
26577
27480
  *
26578
27481
  * @param options Object containing:
@@ -27092,6 +27995,35 @@ function convertCoreSubmodelElementToApiSubmodelElement(submodelElement) {
27092
27995
  return JSON.parse(submodelElementStr);
27093
27996
  }
27094
27997
  //#endregion
27998
+ //#region dist/lib/operationHandle.js
27999
+ const OPERATION_STATUS_SEGMENT = /(?:^|\/)operation-status\/([^/?#]+)\/?(?:[?#].*)?$/;
28000
+ /**
28001
+ * Returns the handle of an asynchronously invoked Operation from the `Location` header of the `202 Accepted`
28002
+ * response, or `undefined` if the header is missing or does not point to an `operation-status` resource.
28003
+ *
28004
+ * The `Location` header may be absolute or a relative reference (RFC 9110, section 10.2.2), e.g.
28005
+ * `operation-status/{handleId}` relative to the invocation URL. It is returned unchanged. The handle id is
28006
+ * URL-decoded, so it can be passed to `getOperationAsyncStatus` and `getOperationAsyncResult` as is.
28007
+ */
28008
+ function getOperationHandle(response) {
28009
+ const headers = response?.headers;
28010
+ if (typeof headers?.get !== "function") return;
28011
+ const location = headers.get("Location");
28012
+ const encodedHandleId = location?.match(OPERATION_STATUS_SEGMENT)?.[1];
28013
+ if (location == null || encodedHandleId === void 0) return;
28014
+ try {
28015
+ return {
28016
+ handleId: decodeURIComponent(encodedHandleId),
28017
+ location
28018
+ };
28019
+ } catch {
28020
+ return {
28021
+ handleId: encodedHandleId,
28022
+ location
28023
+ };
28024
+ }
28025
+ }
28026
+ //#endregion
27095
28027
  //#region dist/clients/AasRepositoryClient.js
27096
28028
  var AasRepositoryClient = class AasRepositoryClient {
27097
28029
  static requireIdentifier(value, field) {
@@ -27152,6 +28084,42 @@ var AasRepositoryClient = class AasRepositoryClient {
27152
28084
  }
27153
28085
  }
27154
28086
  /**
28087
+ * Returns all Asset Administration Shells that conform to the query (AAS Query Language)
28088
+ *
28089
+ * @param options Object containing:
28090
+ * - configuration: The http request options
28091
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aas#idShort'), new StringLiteral('Robot')]))`
28092
+ * - limit?: The maximum number of elements in the response array
28093
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
28094
+ *
28095
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
28096
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
28097
+ */
28098
+ async queryAssetAdministrationShells(options) {
28099
+ const { configuration, query, limit, cursor } = options;
28100
+ try {
28101
+ const response = await new AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration)).queryAssetAdministrationShellsRaw({
28102
+ query: toQueryRequestBody(query),
28103
+ limit,
28104
+ cursor
28105
+ });
28106
+ return {
28107
+ success: true,
28108
+ data: convertQueryResult(await response.value(), query, "AssetAdministrationShell", convertApiAasToCoreAas),
28109
+ statusCode: response.raw.status,
28110
+ etag: getEtag(response.raw)
28111
+ };
28112
+ } catch (err) {
28113
+ const customError = await handleApiError(err);
28114
+ return {
28115
+ success: false,
28116
+ error: customError,
28117
+ statusCode: AasRepositoryClient.extractStatusCode(err, customError),
28118
+ ...getConditionalErrorFields(err)
28119
+ };
28120
+ }
28121
+ }
28122
+ /**
27155
28123
  * Returns References to all Asset Administration Shells
27156
28124
  *
27157
28125
  * @param options Object containing:
@@ -29133,6 +30101,10 @@ var AasRepositoryClient = class AasRepositoryClient {
29133
30101
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
29134
30102
  *
29135
30103
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
30104
+ * `data` is the handle of the invocation, taken from the `Location` header, for
30105
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
30106
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
30107
+ * `Access-Control-Expose-Headers`).
29136
30108
  */
29137
30109
  async invokeOperationAsyncAasRepository(options) {
29138
30110
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
@@ -29148,7 +30120,7 @@ var AasRepositoryClient = class AasRepositoryClient {
29148
30120
  });
29149
30121
  return {
29150
30122
  success: true,
29151
- data: await response.value(),
30123
+ data: getOperationHandle(response.raw),
29152
30124
  statusCode: response.raw.status,
29153
30125
  etag: getEtag(response.raw)
29154
30126
  };
@@ -29174,6 +30146,10 @@ var AasRepositoryClient = class AasRepositoryClient {
29174
30146
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
29175
30147
  *
29176
30148
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
30149
+ * `data` is the handle of the invocation, taken from the `Location` header, for
30150
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
30151
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
30152
+ * `Access-Control-Expose-Headers`).
29177
30153
  */
29178
30154
  async invokeOperationAsyncValueOnlyAasRepository(options) {
29179
30155
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
@@ -29189,7 +30165,7 @@ var AasRepositoryClient = class AasRepositoryClient {
29189
30165
  });
29190
30166
  return {
29191
30167
  success: true,
29192
- data: await response.value(),
30168
+ data: getOperationHandle(response.raw),
29193
30169
  statusCode: response.raw.status,
29194
30170
  etag: getEtag(response.raw)
29195
30171
  };
@@ -29829,6 +30805,42 @@ var ConceptDescriptionRepositoryClient = class ConceptDescriptionRepositoryClien
29829
30805
  }
29830
30806
  }
29831
30807
  /**
30808
+ * Returns all Concept Descriptions that conform to the query (AAS Query Language)
30809
+ *
30810
+ * @param options Object containing:
30811
+ * - configuration: The http request options
30812
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$cd#idShort'), new StringLiteral('Voltage')]))`
30813
+ * - limit?: The maximum number of elements in the response array
30814
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
30815
+ *
30816
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
30817
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
30818
+ */
30819
+ async queryConceptDescriptions(options) {
30820
+ const { configuration, query, limit, cursor } = options;
30821
+ try {
30822
+ const response = await new ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration)).queryConceptDescriptionsRaw({
30823
+ query: toQueryRequestBody(query),
30824
+ limit,
30825
+ cursor
30826
+ });
30827
+ return {
30828
+ success: true,
30829
+ data: convertQueryResult(await response.value(), query, "ConceptDescription", convertApiCDToCoreCD),
30830
+ statusCode: response.raw.status,
30831
+ etag: getEtag(response.raw)
30832
+ };
30833
+ } catch (err) {
30834
+ const customError = await handleApiError(err);
30835
+ return {
30836
+ success: false,
30837
+ error: customError,
30838
+ statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
30839
+ ...getConditionalErrorFields(err)
30840
+ };
30841
+ }
30842
+ }
30843
+ /**
29832
30844
  * Creates a new Concept Description
29833
30845
  *
29834
30846
  * @param options Object containing:
@@ -29976,6 +30988,42 @@ var SubmodelRegistryClient = class SubmodelRegistryClient {
29976
30988
  }
29977
30989
  }
29978
30990
  /**
30991
+ * Returns all Submodel Descriptors that conform to the query (AAS Query Language)
30992
+ *
30993
+ * @param options Object containing:
30994
+ * - configuration: The http request options
30995
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$smdesc#idShort'), new StringLiteral('Nameplate')]))`
30996
+ * - limit?: The maximum number of elements in the response array
30997
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
30998
+ *
30999
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
31000
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
31001
+ */
31002
+ async querySubmodelDescriptors(options) {
31003
+ const { configuration, query, limit, cursor } = options;
31004
+ try {
31005
+ const response = await new SubmodelRegistryAPIApi(applyDefaults(configuration)).querySubmodelDescriptorsRaw({
31006
+ query: toQueryRequestBody(query),
31007
+ limit,
31008
+ cursor
31009
+ });
31010
+ return {
31011
+ success: true,
31012
+ data: convertQueryResult(await response.value(), query, "SubmodelDescriptor", convertApiSubmodelDescriptorToCoreSubmodelDescriptor),
31013
+ statusCode: response.raw.status,
31014
+ etag: getEtag(response.raw)
31015
+ };
31016
+ } catch (err) {
31017
+ const customError = await handleApiError(err);
31018
+ return {
31019
+ success: false,
31020
+ error: customError,
31021
+ statusCode: SubmodelRegistryClient.extractStatusCode(err, customError),
31022
+ ...getConditionalErrorFields(err)
31023
+ };
31024
+ }
31025
+ }
31026
+ /**
29979
31027
  * Creates a new Submodel Descriptor, i.e. registers a Submodel
29980
31028
  *
29981
31029
  * @param options Object containing:
@@ -30211,6 +31259,42 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
30211
31259
  }
30212
31260
  }
30213
31261
  /**
31262
+ * Returns all Submodels that conform to the query (AAS Query Language)
31263
+ *
31264
+ * @param options Object containing:
31265
+ * - configuration: The http request options
31266
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$sm#idShort'), new StringLiteral('Nameplate')]))`
31267
+ * - limit?: The maximum number of elements in the response array
31268
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
31269
+ *
31270
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
31271
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
31272
+ */
31273
+ async querySubmodels(options) {
31274
+ const { configuration, query, limit, cursor } = options;
31275
+ try {
31276
+ const response = await new SubmodelRepositoryAPIApi(applyDefaults(configuration)).querySubmodelsRaw({
31277
+ query: toQueryRequestBody(query),
31278
+ limit,
31279
+ cursor
31280
+ });
31281
+ return {
31282
+ success: true,
31283
+ data: convertQueryResult(await response.value(), query, "Submodel", convertApiSubmodelToCoreSubmodel),
31284
+ statusCode: response.raw.status,
31285
+ etag: getEtag(response.raw)
31286
+ };
31287
+ } catch (err) {
31288
+ const customError = await handleApiError(err);
31289
+ return {
31290
+ success: false,
31291
+ error: customError,
31292
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
31293
+ ...getConditionalErrorFields(err)
31294
+ };
31295
+ }
31296
+ }
31297
+ /**
30214
31298
  * Returns all Submodels in metadata representation
30215
31299
  *
30216
31300
  * @param options Object containing:
@@ -31639,7 +32723,6 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31639
32723
  *
31640
32724
  * @param options Object containing:
31641
32725
  * - configuration: The http request options.
31642
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
31643
32726
  * - submodelIdentifier: The Submodel’s unique id
31644
32727
  * - idShortPath: IdShort path to the submodel element (dot-separated)
31645
32728
  * - operationRequestValueOnly: Operation request object
@@ -31648,13 +32731,11 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31648
32731
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
31649
32732
  */
31650
32733
  async postInvokeOperationValueOnly(options) {
31651
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
32734
+ const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
31652
32735
  try {
31653
32736
  const apiInstance = new SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
31654
- const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, "aasIdentifier"));
31655
32737
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, "submodelIdentifier"));
31656
32738
  const response = await apiInstance.invokeOperationValueOnlyRaw({
31657
- aasIdentifier: encodedAasIdentifier,
31658
32739
  submodelIdentifier: encodedSubmodelIdentifier,
31659
32740
  idShortPath,
31660
32741
  operationRequestValueOnly
@@ -31686,6 +32767,9 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31686
32767
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
31687
32768
  *
31688
32769
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
32770
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
32771
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
32772
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
31689
32773
  */
31690
32774
  async postInvokeOperationAsync(options) {
31691
32775
  const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
@@ -31699,7 +32783,7 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31699
32783
  });
31700
32784
  return {
31701
32785
  success: true,
31702
- data: await response.value(),
32786
+ data: getOperationHandle(response.raw),
31703
32787
  statusCode: response.raw.status,
31704
32788
  etag: getEtag(response.raw)
31705
32789
  };
@@ -31718,29 +32802,29 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31718
32802
  *
31719
32803
  * @param options Object containing:
31720
32804
  * - configuration: The http request options.
31721
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
31722
32805
  * - submodelIdentifier: The Submodel’s unique id
31723
32806
  * - idShortPath: IdShort path to the submodel element (dot-separated)
31724
32807
  * - operationRequestValueOnly: Operation request object
31725
32808
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
31726
32809
  *
31727
32810
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
32811
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
32812
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
32813
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
31728
32814
  */
31729
32815
  async postInvokeOperationAsyncValueOnly(options) {
31730
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
32816
+ const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
31731
32817
  try {
31732
32818
  const apiInstance = new SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
31733
- const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, "aasIdentifier"));
31734
32819
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, "submodelIdentifier"));
31735
32820
  const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
31736
- aasIdentifier: encodedAasIdentifier,
31737
32821
  submodelIdentifier: encodedSubmodelIdentifier,
31738
32822
  idShortPath,
31739
32823
  operationRequestValueOnly
31740
32824
  });
31741
32825
  return {
31742
32826
  success: true,
31743
- data: await response.value(),
32827
+ data: getOperationHandle(response.raw),
31744
32828
  statusCode: response.raw.status,
31745
32829
  etag: getEtag(response.raw)
31746
32830
  };
@@ -31931,36 +33015,183 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
31931
33015
  };
31932
33016
  //#endregion
31933
33017
  //#region dist/utils/DescriptorUtils.js
31934
- var DescriptorUtils_exports = /* @__PURE__ */ __exportAll({ extractEndpointHref: () => extractEndpointHref });
33018
+ var DescriptorUtils_exports = /* @__PURE__ */ __exportAll({
33019
+ extractEndpointHref: () => extractEndpointHref,
33020
+ findEndpoint: () => findEndpoint,
33021
+ isRepositoryEndpoint: () => isRepositoryEndpoint
33022
+ });
33023
+ const interfaceShortNames = [
33024
+ "AAS",
33025
+ "SUBMODEL",
33026
+ "SERIALIZE",
33027
+ "DESCRIPTION",
33028
+ "AASX-FILE",
33029
+ "AAS-REGISTRY",
33030
+ "SUBMODEL-REGISTRY",
33031
+ "AAS-REPOSITORY",
33032
+ "SUBMODEL-REPOSITORY",
33033
+ "CD-REPOSITORY",
33034
+ "AAS-DISCOVERY"
33035
+ ];
33036
+ /**
33037
+ * Finds the endpoint of a descriptor that matches the given interface short name.
33038
+ *
33039
+ * An exact match on `endpoint._interface` is preferred. For `AAS-3.x` and `SUBMODEL-3.x` requests,
33040
+ * other 3.x versions are accepted as well, in this order:
33041
+ * 1. exact match (e.g. `AAS-3.0`)
33042
+ * 2. any direct interface of major version 3 (e.g. `AAS-3.1`, `AAS-3.2`)
33043
+ * 3. the repository interface of the same version (e.g. `AAS-REPOSITORY-3.0`)
33044
+ * 4. any repository interface of major version 3 (e.g. `AAS-REPOSITORY-3.2`)
33045
+ *
33046
+ * The href of a repository interface points to the repository base path instead of the resource itself.
33047
+ *
33048
+ * @param {Object} descriptor - The descriptor containing endpoint information.
33049
+ * @param {string} interfaceShortName - The short name of the interface to match against endpoint interfaces.
33050
+ * @returns {Endpoint | undefined} The matching endpoint, or `undefined` if there is none.
33051
+ */
33052
+ function findEndpoint(descriptor, interfaceShortName) {
33053
+ if (!interfaceShortName || interfaceShortName.trim() === "") return void 0;
33054
+ interfaceShortName = interfaceShortName.trim().toUpperCase();
33055
+ if (!interfaceShortNames.some((iShortName) => interfaceShortName.startsWith(`${iShortName}-`))) return;
33056
+ if (!Array.isArray(descriptor?.endpoints) || descriptor.endpoints.length === 0) return;
33057
+ const endpoints = descriptor.endpoints.filter((endpoint) => endpoint?.protocolInformation?.href);
33058
+ const interfaceOf = (endpoint) => endpoint._interface?.trim().toUpperCase();
33059
+ const exactMatch = endpoints.find((endpoint) => interfaceOf(endpoint) === interfaceShortName);
33060
+ if (exactMatch) return exactMatch;
33061
+ const versionedInterface = /^(AAS|SUBMODEL)-(3\.\d+(?:\.\d+)*)$/.exec(interfaceShortName);
33062
+ if (!versionedInterface) return void 0;
33063
+ const [, interfaceName, version] = versionedInterface;
33064
+ const directInterfacePattern = new RegExp(String.raw`^${interfaceName}-3\.\d+(?:\.\d+)*$`);
33065
+ const repositoryInterfacePattern = new RegExp(String.raw`^${interfaceName}-REPOSITORY-3\.\d+(?:\.\d+)*$`);
33066
+ return endpoints.find((endpoint) => directInterfacePattern.test(interfaceOf(endpoint) ?? "")) ?? endpoints.find((endpoint) => interfaceOf(endpoint) === `${interfaceName}-REPOSITORY-${version}`) ?? endpoints.find((endpoint) => repositoryInterfacePattern.test(interfaceOf(endpoint) ?? ""));
33067
+ }
33068
+ /**
33069
+ * Checks whether an endpoint uses a repository interface (e.g. `AAS-REPOSITORY-3.0`).
33070
+ * The href of such an endpoint points to the repository base path instead of the resource itself.
33071
+ *
33072
+ * @param {Endpoint} endpoint - The endpoint to check.
33073
+ * @returns {boolean} `true` if the endpoint uses a repository interface.
33074
+ */
33075
+ function isRepositoryEndpoint(endpoint) {
33076
+ return /^[A-Z-]+-REPOSITORY-/.test(endpoint?._interface?.trim().toUpperCase() ?? "");
33077
+ }
31935
33078
  /**
31936
33079
  * Extracts the endpoint from a descriptor based on the given interface short name.
33080
+ * See {@link findEndpoint} for the order in which endpoints are matched.
31937
33081
  *
31938
33082
  * @param {Object} descriptor - The descriptor containing endpoint information.
31939
33083
  * @param {string} interfaceShortName - The short name of the interface to match against endpoint interfaces.
31940
33084
  * @returns {string} The href of the matching endpoint's protocol information if found, otherwise an empty string.
31941
33085
  */
31942
33086
  function extractEndpointHref(descriptor, interfaceShortName) {
31943
- const failResponse = "";
31944
- const interfaceShortNames = [
31945
- "AAS",
31946
- "SUBMODEL",
31947
- "SERIALIZE",
31948
- "DESCRIPTION",
31949
- "AASX-FILE",
31950
- "AAS-REGISTRY",
31951
- "SUBMODEL-REGISTRY",
31952
- "AAS-REPOSITORY",
31953
- "SUBMODEL-REPOSITORY",
31954
- "CD-REPOSITORY",
31955
- "AAS-DISCOVERY"
31956
- ];
31957
- if (!interfaceShortName || interfaceShortName.trim() === "") return failResponse;
31958
- interfaceShortName = interfaceShortName.trim();
31959
- interfaceShortName = interfaceShortName.toUpperCase();
31960
- if (!interfaceShortNames.some((iShortName) => interfaceShortName.startsWith(`${iShortName}-`))) return failResponse;
31961
- if (!Array.isArray(descriptor?.endpoints) || descriptor?.endpoints.length === 0) return failResponse;
31962
- const endpoint = descriptor.endpoints.find((endpoint) => endpoint?._interface === interfaceShortName);
31963
- return endpoint?.protocolInformation?.href ? endpoint.protocolInformation.href : "";
33087
+ return findEndpoint(descriptor, interfaceShortName)?.protocolInformation?.href ?? "";
33088
+ }
33089
+ //#endregion
33090
+ //#region dist/lib/endpointConfiguration.js
33091
+ /**
33092
+ * Splits a resource URL like `http://host/prefix/shells/{encodedId}` into the repository base path and the
33093
+ * encoded identifier.
33094
+ *
33095
+ * @param href The resource URL
33096
+ * @param collection The collection segment (`shells` or `submodels`)
33097
+ * @returns The base path and encoded identifier, or `undefined` if the URL does not match
33098
+ */
33099
+ function splitResourceHref(href, collection) {
33100
+ const match = href.match(new RegExp(String.raw`^(https?:\/\/[^/?#]+(?:\/[^?#]*?)?)\/${collection}\/([^/?#]+)\/?$`));
33101
+ if (!match) return void 0;
33102
+ return {
33103
+ basePath: match[1],
33104
+ encodedId: match[2]
33105
+ };
33106
+ }
33107
+ /**
33108
+ * Resolves the endpoint of a descriptor for the given interface family (`AAS` or `SUBMODEL`).
33109
+ * Repository interface endpoints are expanded to the resource URL of the descriptor's identifier.
33110
+ *
33111
+ * @param descriptor The descriptor
33112
+ * @param interfaceName `AAS` or `SUBMODEL`
33113
+ * @returns The resolved endpoint, or `undefined` if the descriptor has no usable endpoint
33114
+ */
33115
+ function resolveDescriptorEndpoint(descriptor, interfaceName) {
33116
+ const endpoint = findEndpoint(descriptor, `${interfaceName}-3.0`);
33117
+ const endpointHref = endpoint?.protocolInformation?.href?.trim();
33118
+ if (!endpoint || !endpointHref) return void 0;
33119
+ const collection = interfaceName === "AAS" ? "shells" : "submodels";
33120
+ if (isRepositoryEndpoint(endpoint)) {
33121
+ if (!descriptor.id) return void 0;
33122
+ const basePath = endpointHref.replace(/\/+$/, "");
33123
+ return {
33124
+ href: `${basePath}/${collection}/${base64Encode(descriptor.id)}`,
33125
+ basePath
33126
+ };
33127
+ }
33128
+ return {
33129
+ href: endpointHref,
33130
+ basePath: splitResourceHref(endpointHref, collection)?.basePath ?? endpointHref
33131
+ };
33132
+ }
33133
+ /**
33134
+ * Creates a configuration for the given base path that keeps the auth, fetch and middleware settings of `source`.
33135
+ *
33136
+ * @param basePath The base path to target
33137
+ * @param source The configuration to take the settings from
33138
+ * @returns The new configuration
33139
+ */
33140
+ function withBasePath(basePath, source) {
33141
+ if (!source) return new Configuration({ basePath });
33142
+ return new Configuration({
33143
+ basePath,
33144
+ fetchApi: source.fetchApi,
33145
+ middleware: source.middleware,
33146
+ queryParamsStringify: source.queryParamsStringify,
33147
+ username: source.username,
33148
+ password: source.password,
33149
+ apiKey: source.apiKey,
33150
+ accessToken: source.accessToken,
33151
+ headers: source.headers,
33152
+ credentials: source.credentials
33153
+ });
33154
+ }
33155
+ /**
33156
+ * Determines the configuration for a request to a descriptor endpoint.
33157
+ *
33158
+ * If a resolver is given, it decides: it returns the configuration to use, or rejects the endpoint by returning
33159
+ * `null`/`undefined` or throwing. Otherwise, the settings of the fallback configuration (if any) are used.
33160
+ *
33161
+ * @param href The full endpoint URL
33162
+ * @param basePath The base path to send the request to
33163
+ * @param resolver The caller's endpoint configuration hook
33164
+ * @param fallback The configuration to take settings from if no resolver is given
33165
+ * @returns The configuration, or an `EndpointRejected` error
33166
+ */
33167
+ async function createEndpointConfiguration(href, basePath, resolver, fallback) {
33168
+ if (!resolver) return {
33169
+ success: true,
33170
+ configuration: withBasePath(basePath, fallback)
33171
+ };
33172
+ let configuration;
33173
+ try {
33174
+ configuration = await resolver(href);
33175
+ } catch (error) {
33176
+ return {
33177
+ success: false,
33178
+ error: {
33179
+ errorType: "EndpointRejected",
33180
+ message: `Endpoint ${href} was rejected: ${error instanceof Error ? error.message : String(error)}`
33181
+ }
33182
+ };
33183
+ }
33184
+ if (!configuration) return {
33185
+ success: false,
33186
+ error: {
33187
+ errorType: "EndpointRejected",
33188
+ message: `Endpoint ${href} was rejected`
33189
+ }
33190
+ };
33191
+ return {
33192
+ success: true,
33193
+ configuration: withBasePath(basePath, configuration)
33194
+ };
31964
33195
  }
31965
33196
  //#endregion
31966
33197
  //#region dist/services/SubmodelService.js
@@ -31979,6 +33210,7 @@ var SubmodelService = class {
31979
33210
  submodelRegistryConfig;
31980
33211
  submodelRepositoryConfig;
31981
33212
  conceptDescriptionRepositoryConfig;
33213
+ endpointConfiguration;
31982
33214
  constructor(config) {
31983
33215
  this.submodelRegistryClient = new SubmodelRegistryClient();
31984
33216
  this.submodelRepositoryClient = new SubmodelRepositoryClient();
@@ -31986,6 +33218,7 @@ var SubmodelService = class {
31986
33218
  this.submodelRegistryConfig = config.submodelRegistryConfig;
31987
33219
  this.submodelRepositoryConfig = config.submodelRepositoryConfig;
31988
33220
  this.conceptDescriptionRepositoryConfig = config.conceptDescriptionRepositoryConfig;
33221
+ this.endpointConfiguration = config.endpointConfiguration;
31989
33222
  }
31990
33223
  /**
31991
33224
  * Retrieves a list of all Submodels.
@@ -32029,13 +33262,13 @@ var SubmodelService = class {
32029
33262
  message: "Submodel descriptor does not contain an id and cannot be resolved"
32030
33263
  }
32031
33264
  };
32032
- const endpoint = descriptor.endpoints?.[0]?.protocolInformation?.href;
33265
+ const endpoint = resolveDescriptorEndpoint(descriptor, "SUBMODEL")?.href;
32033
33266
  if (!endpoint) return {
32034
33267
  submodel: null,
32035
33268
  warning: {
32036
33269
  submodelIdentifier: descriptor.id,
32037
33270
  errorType: "MissingEndpoint",
32038
- message: "Submodel descriptor has no endpoint and cannot be resolved"
33271
+ message: "Submodel descriptor has no SUBMODEL-3.x endpoint and cannot be resolved"
32039
33272
  }
32040
33273
  };
32041
33274
  const submodelResult = await this.getSubmodelByEndpoint({ endpoint });
@@ -32134,7 +33367,7 @@ var SubmodelService = class {
32134
33367
  });
32135
33368
  if (descriptorResult.success) {
32136
33369
  const descriptor = descriptorResult.data;
32137
- const endpoint = descriptor.endpoints?.[0]?.protocolInformation?.href;
33370
+ const endpoint = resolveDescriptorEndpoint(descriptor, "SUBMODEL")?.href;
32138
33371
  if (endpoint) {
32139
33372
  const submodelResult = await this.getSubmodelByEndpoint({
32140
33373
  endpoint,
@@ -32203,7 +33436,7 @@ var SubmodelService = class {
32203
33436
  submodelIdentifier
32204
33437
  });
32205
33438
  if (descriptorResult.success) {
32206
- const endpoint = descriptorResult.data.endpoints?.[0]?.protocolInformation?.href;
33439
+ const endpoint = resolveDescriptorEndpoint(descriptorResult.data, "SUBMODEL")?.href;
32207
33440
  if (endpoint) return {
32208
33441
  success: true,
32209
33442
  data: endpoint
@@ -32227,9 +33460,10 @@ var SubmodelService = class {
32227
33460
  *
32228
33461
  * Extracts the base URL and base64url-encoded Submodel identifier from the endpoint,
32229
33462
  * decodes the identifier, and fetches the submodel from the repository.
33463
+ * If an `endpointConfiguration` hook is configured, it decides whether and how the endpoint is contacted.
32230
33464
  *
32231
33465
  * @param options Object containing:
32232
- * - endpoint: The endpoint URL (format: http://host/submodels/{base64EncodedId})
33466
+ * - endpoint: The endpoint URL (format: http://host[/basePath]/submodels/{base64EncodedId})
32233
33467
  * - includeConceptDescriptions?: Whether to fetch concept descriptions (default: false)
32234
33468
  *
32235
33469
  * @returns Either `{ success: true; data: { submodel, conceptDescriptions? }; etag? }` or `{ success: false; error: ... }`.
@@ -32237,15 +33471,15 @@ var SubmodelService = class {
32237
33471
  */
32238
33472
  async getSubmodelByEndpoint(options) {
32239
33473
  const { endpoint, includeConceptDescriptions = false } = options;
32240
- const match = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)\/submodels\/([^/]+)$/);
32241
- if (!match) return {
33474
+ const parts = splitResourceHref(endpoint, "submodels");
33475
+ if (!parts) return {
32242
33476
  success: false,
32243
33477
  error: {
32244
33478
  errorType: "InvalidEndpoint",
32245
33479
  message: "Invalid endpoint format. Expected format: http://host/submodels/{base64EncodedId}"
32246
33480
  }
32247
33481
  };
32248
- const [, baseUrl, encodedId] = match;
33482
+ const { basePath: baseUrl, encodedId } = parts;
32249
33483
  let submodelIdentifier;
32250
33484
  try {
32251
33485
  submodelIdentifier = base64Decode(encodedId);
@@ -32258,9 +33492,13 @@ var SubmodelService = class {
32258
33492
  }
32259
33493
  };
32260
33494
  }
32261
- const config = this.createRepositoryEndpointConfiguration(baseUrl);
33495
+ const configResult = await createEndpointConfiguration(endpoint, baseUrl, this.endpointConfiguration, this.submodelRepositoryConfig);
33496
+ if (!configResult.success) return {
33497
+ success: false,
33498
+ error: configResult.error
33499
+ };
32262
33500
  const submodelResult = await this.submodelRepositoryClient.getSubmodelById({
32263
- configuration: config,
33501
+ configuration: configResult.configuration,
32264
33502
  submodelIdentifier
32265
33503
  });
32266
33504
  if (!submodelResult.success) return {
@@ -32280,27 +33518,6 @@ var SubmodelService = class {
32280
33518
  };
32281
33519
  }
32282
33520
  /**
32283
- * Creates a repository configuration for an endpoint while preserving auth and middleware.
32284
- *
32285
- * @param basePath The endpoint base path to target
32286
- * @returns Configuration with endpoint basePath plus repository auth/settings
32287
- */
32288
- createRepositoryEndpointConfiguration(basePath) {
32289
- if (!this.submodelRepositoryConfig) return new Configuration({ basePath });
32290
- return new Configuration({
32291
- basePath,
32292
- fetchApi: this.submodelRepositoryConfig.fetchApi,
32293
- middleware: this.submodelRepositoryConfig.middleware,
32294
- queryParamsStringify: this.submodelRepositoryConfig.queryParamsStringify,
32295
- username: this.submodelRepositoryConfig.username,
32296
- password: this.submodelRepositoryConfig.password,
32297
- apiKey: this.submodelRepositoryConfig.apiKey,
32298
- accessToken: this.submodelRepositoryConfig.accessToken,
32299
- headers: this.submodelRepositoryConfig.headers,
32300
- credentials: this.submodelRepositoryConfig.credentials
32301
- });
32302
- }
32303
- /**
32304
33521
  * Creates a Submodel and optionally registers it in the registry.
32305
33522
  *
32306
33523
  * This method creates the Submodel in the repository first. If registry is configured
@@ -32590,6 +33807,7 @@ var AasService = class {
32590
33807
  aasRegistryConfig;
32591
33808
  aasRepositoryConfig;
32592
33809
  discoveryConfig;
33810
+ endpointConfiguration;
32593
33811
  submodelService;
32594
33812
  constructor(config) {
32595
33813
  this.aasRegistryClient = new AasRegistryClient();
@@ -32598,10 +33816,12 @@ var AasService = class {
32598
33816
  this.aasRegistryConfig = config.aasRegistryConfig;
32599
33817
  this.aasRepositoryConfig = config.aasRepositoryConfig;
32600
33818
  this.discoveryConfig = config.discoveryConfig;
33819
+ this.endpointConfiguration = config.endpointConfiguration;
32601
33820
  this.submodelService = new SubmodelService({
32602
33821
  submodelRegistryConfig: config.submodelRegistryConfig ?? config.aasRegistryConfig,
32603
33822
  submodelRepositoryConfig: config.submodelRepositoryConfig ?? config.aasRepositoryConfig,
32604
- conceptDescriptionRepositoryConfig: config.conceptDescriptionRepositoryConfig
33823
+ conceptDescriptionRepositoryConfig: config.conceptDescriptionRepositoryConfig,
33824
+ endpointConfiguration: config.endpointConfiguration
32605
33825
  });
32606
33826
  }
32607
33827
  /**
@@ -32648,19 +33868,27 @@ var AasService = class {
32648
33868
  });
32649
33869
  continue;
32650
33870
  }
32651
- const endpoint = extractEndpointHref(descriptor, "AAS-3.0");
32652
- if (!endpoint) {
33871
+ const resolvedEndpoint = resolveDescriptorEndpoint(descriptor, "AAS");
33872
+ if (!resolvedEndpoint) {
32653
33873
  warnings.push({
32654
33874
  descriptorId: descriptor.id,
32655
33875
  errorType: "MissingEndpoint",
32656
- message: "AAS descriptor has no AAS-3.0 endpoint and cannot be resolved"
33876
+ message: "AAS descriptor has no AAS-3.x endpoint and cannot be resolved"
33877
+ });
33878
+ continue;
33879
+ }
33880
+ const endpoint = resolvedEndpoint.href;
33881
+ const configResult = await this.createEndpointConfiguration(endpoint, resolvedEndpoint.basePath);
33882
+ if (!configResult.success) {
33883
+ warnings.push({
33884
+ descriptorId: descriptor.id,
33885
+ endpoint,
33886
+ ...configResult.error
32657
33887
  });
32658
33888
  continue;
32659
33889
  }
32660
- const baseUrl = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)/)?.[1] || endpoint;
32661
- const config = this.createRepositoryEndpointConfiguration(baseUrl);
32662
33890
  const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
32663
- configuration: config,
33891
+ configuration: configResult.configuration,
32664
33892
  aasIdentifier: descriptor.id
32665
33893
  });
32666
33894
  if (shellResult.success) shells.push(shellResult.data);
@@ -32756,12 +33984,11 @@ var AasService = class {
32756
33984
  });
32757
33985
  if (descriptorResult.success) {
32758
33986
  const descriptor = descriptorResult.data;
32759
- const endpoint = extractEndpointHref(descriptor, "AAS-3.0");
32760
- if (endpoint) {
32761
- const baseUrl = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)/)?.[1] || endpoint;
32762
- const config = this.createRepositoryEndpointConfiguration(baseUrl);
33987
+ const resolvedEndpoint = resolveDescriptorEndpoint(descriptor, "AAS");
33988
+ const configResult = resolvedEndpoint ? await this.createEndpointConfiguration(resolvedEndpoint.href, resolvedEndpoint.basePath) : void 0;
33989
+ if (configResult?.success) {
32763
33990
  const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
32764
- configuration: config,
33991
+ configuration: configResult.configuration,
32765
33992
  aasIdentifier
32766
33993
  });
32767
33994
  if (shellResult.success) {
@@ -32832,7 +34059,7 @@ var AasService = class {
32832
34059
  aasIdentifier
32833
34060
  });
32834
34061
  if (descriptorResult.success) {
32835
- const endpoint = extractEndpointHref(descriptorResult.data, "AAS-3.0");
34062
+ const endpoint = resolveDescriptorEndpoint(descriptorResult.data, "AAS")?.href;
32836
34063
  if (endpoint) return {
32837
34064
  success: true,
32838
34065
  data: endpoint
@@ -32856,9 +34083,10 @@ var AasService = class {
32856
34083
  *
32857
34084
  * Extracts the base URL and base64url-encoded AAS identifier from the endpoint,
32858
34085
  * decodes the identifier, and fetches the shell from the repository.
34086
+ * If an `endpointConfiguration` hook is configured, it decides whether and how the endpoint is contacted.
32859
34087
  *
32860
34088
  * @param options Object containing:
32861
- * - endpoint: The endpoint URL (format: http://host/shells/{base64EncodedId})
34089
+ * - endpoint: The endpoint URL (format: http://host[/basePath]/shells/{base64EncodedId})
32862
34090
  * - includeSubmodels?: Whether to fetch submodels for the shell (default: false)
32863
34091
  * - includeConceptDescriptions?: Whether to fetch concept descriptions (default: false)
32864
34092
  *
@@ -32867,15 +34095,15 @@ var AasService = class {
32867
34095
  */
32868
34096
  async getAasByEndpoint(options) {
32869
34097
  const { endpoint, includeSubmodels = false } = options;
32870
- const match = endpoint.match(/^(https?:\/\/[^/]+(?::\d+)?)\/shells\/([^/]+)$/);
32871
- if (!match) return {
34098
+ const parts = splitResourceHref(endpoint, "shells");
34099
+ if (!parts) return {
32872
34100
  success: false,
32873
34101
  error: {
32874
34102
  errorType: "InvalidEndpoint",
32875
34103
  message: "Invalid endpoint format. Expected format: http://host/shells/{base64EncodedId}"
32876
34104
  }
32877
34105
  };
32878
- const [, baseUrl, encodedId] = match;
34106
+ const { basePath: baseUrl, encodedId } = parts;
32879
34107
  let aasIdentifier;
32880
34108
  try {
32881
34109
  aasIdentifier = base64Decode(encodedId);
@@ -32888,9 +34116,13 @@ var AasService = class {
32888
34116
  }
32889
34117
  };
32890
34118
  }
32891
- const config = this.createRepositoryEndpointConfiguration(baseUrl);
34119
+ const configResult = await this.createEndpointConfiguration(endpoint, baseUrl);
34120
+ if (!configResult.success) return {
34121
+ success: false,
34122
+ error: configResult.error
34123
+ };
32892
34124
  const shellResult = await this.aasRepositoryClient.getAssetAdministrationShellById({
32893
- configuration: config,
34125
+ configuration: configResult.configuration,
32894
34126
  aasIdentifier
32895
34127
  });
32896
34128
  if (!shellResult.success) return {
@@ -33234,25 +34466,15 @@ var AasService = class {
33234
34466
  };
33235
34467
  }
33236
34468
  /**
33237
- * Creates a repository configuration for an endpoint while preserving auth and middleware.
34469
+ * Determines the configuration for a request to an AAS endpoint, using the `endpointConfiguration` hook if
34470
+ * configured and the repository settings otherwise.
33238
34471
  *
34472
+ * @param href The full endpoint URL
33239
34473
  * @param basePath The endpoint base path to target
33240
- * @returns Configuration with endpoint basePath plus repository auth/settings
33241
- */
33242
- createRepositoryEndpointConfiguration(basePath) {
33243
- if (!this.aasRepositoryConfig) return new Configuration({ basePath });
33244
- return new Configuration({
33245
- basePath,
33246
- fetchApi: this.aasRepositoryConfig.fetchApi,
33247
- middleware: this.aasRepositoryConfig.middleware,
33248
- queryParamsStringify: this.aasRepositoryConfig.queryParamsStringify,
33249
- username: this.aasRepositoryConfig.username,
33250
- password: this.aasRepositoryConfig.password,
33251
- apiKey: this.aasRepositoryConfig.apiKey,
33252
- accessToken: this.aasRepositoryConfig.accessToken,
33253
- headers: this.aasRepositoryConfig.headers,
33254
- credentials: this.aasRepositoryConfig.credentials
33255
- });
34474
+ * @returns The configuration, or an `EndpointRejected` error
34475
+ */
34476
+ createEndpointConfiguration(href, basePath) {
34477
+ return createEndpointConfiguration(href, basePath, this.endpointConfiguration, this.aasRepositoryConfig);
33256
34478
  }
33257
34479
  /**
33258
34480
  * Helper method to create an AAS descriptor from an AssetAdministrationShell.
@@ -35094,11 +36316,13 @@ var lib_exports = /* @__PURE__ */ __exportAll({
35094
36316
  endpointFromJsonable: () => endpointFromJsonable,
35095
36317
  handleApiError: () => handleApiError,
35096
36318
  protocolInformationFromJsonable: () => protocolInformationFromJsonable,
36319
+ queryFromJsonable: () => queryFromJsonable,
35097
36320
  serializeXml: () => serializeXml,
35098
36321
  submodelDescriptorFromJsonable: () => submodelDescriptorFromJsonable,
35099
36322
  toJsonableAssetAdministrationShellDescriptor: () => toJsonableAssetAdministrationShellDescriptor,
35100
36323
  toJsonableEndpoint: () => toJsonableEndpoint,
35101
36324
  toJsonableProtocolInformation: () => toJsonableProtocolInformation,
36325
+ toJsonableQuery: () => toJsonableQuery,
35102
36326
  toJsonableSecurityAttribute: () => toJsonableSecurityAttribute,
35103
36327
  toJsonableSubmodelDescriptor: () => toJsonableSubmodelDescriptor
35104
36328
  });
@@ -35735,6 +36959,66 @@ function extractVersionRevision(semanticId) {
35735
36959
  return failResponse;
35736
36960
  }
35737
36961
  //#endregion
36962
+ //#region dist/utils/ServiceDescriptionUtils.js
36963
+ var ServiceDescriptionUtils_exports = /* @__PURE__ */ __exportAll({
36964
+ getQueryEndpoints: () => getQueryEndpoints,
36965
+ supportsQuery: () => supportsQuery
36966
+ });
36967
+ const QUERY_PROFILES = {
36968
+ shells: {
36969
+ specification: "AssetAdministrationShellRepositoryServiceSpecification",
36970
+ profile: "SSP-003"
36971
+ },
36972
+ submodels: {
36973
+ specification: "SubmodelRepositoryServiceSpecification",
36974
+ profile: "SSP-005"
36975
+ },
36976
+ "shell-descriptors": {
36977
+ specification: "AssetAdministrationShellRegistryServiceSpecification",
36978
+ profile: "SSP-004"
36979
+ },
36980
+ "submodel-descriptors": {
36981
+ specification: "SubmodelRegistryServiceSpecification",
36982
+ profile: "SSP-004"
36983
+ },
36984
+ "concept-descriptions": {
36985
+ specification: "ConceptDescriptionRepositoryServiceSpecification",
36986
+ profile: "SSP-002"
36987
+ }
36988
+ };
36989
+ const PROFILE_PATTERN = /\/aas\/API\/3\/\d+\/([A-Za-z]+)\/(SSP-\d+)$/;
36990
+ /**
36991
+ * Returns the query endpoints whose query profile a service advertises in its `ServiceDescription`.
36992
+ *
36993
+ * Profiles are matched by service specification and profile number, regardless of host and API version (both
36994
+ * `https://admin-shell.io/aas/API/3/2/...` and `https://basyx.org/aas/API/3/2/...`). This is a best-effort hint: a
36995
+ * server can serve query endpoints without advertising their profile, so an empty result does not prove that queries
36996
+ * are unsupported.
36997
+ *
36998
+ * @param serviceDescription The result of `getSelfDescription`
36999
+ * @returns The query endpoints with an advertised profile
37000
+ */
37001
+ function getQueryEndpoints(serviceDescription) {
37002
+ const profiles = serviceDescription?.profiles ?? [];
37003
+ return Object.keys(QUERY_PROFILES).filter((endpoint) => profiles.some((profile) => {
37004
+ const match = PROFILE_PATTERN.exec(profile);
37005
+ return match !== null && match[1] === QUERY_PROFILES[endpoint].specification && match[2] === QUERY_PROFILES[endpoint].profile;
37006
+ }));
37007
+ }
37008
+ /**
37009
+ * Checks whether a service advertises the query profile for an endpoint, or for any query endpoint if none is given.
37010
+ *
37011
+ * This is a best-effort hint, see {@link getQueryEndpoints}.
37012
+ *
37013
+ * @param serviceDescription The result of `getSelfDescription`
37014
+ * @param endpoint The query endpoint, e.g. `'shells'` for `/query/shells`
37015
+ * @returns `true` if the matching query profile is advertised
37016
+ */
37017
+ function supportsQuery(serviceDescription, endpoint) {
37018
+ const endpoints = getQueryEndpoints(serviceDescription);
37019
+ return endpoint === void 0 ? endpoints.length > 0 : endpoints.includes(endpoint);
37020
+ }
37021
+ //#endregion
35738
37022
  //#region dist/utils/index.js
35739
37023
  var utils_exports = /* @__PURE__ */ __exportAll({
35740
37024
  DescriptorUtils: () => DescriptorUtils_exports,
@@ -35743,6 +37027,7 @@ var utils_exports = /* @__PURE__ */ __exportAll({
35743
37027
  ReferableUtils: () => ReferableUtils_exports,
35744
37028
  ReferenceUtil: () => ReferenceUtil_exports,
35745
37029
  SemanticIdUtils: () => SemanticIdUtils_exports,
37030
+ ServiceDescriptionUtils: () => ServiceDescriptionUtils_exports,
35746
37031
  checkIdShort: () => checkIdShort,
35747
37032
  checkSemanticId: () => checkSemanticId,
35748
37033
  checkSemanticIdEclassIrdi: () => checkSemanticIdEclassIrdi,
@@ -35753,20 +37038,24 @@ var utils_exports = /* @__PURE__ */ __exportAll({
35753
37038
  extractEndpointHref: () => extractEndpointHref,
35754
37039
  extractId: () => extractId,
35755
37040
  extractVersionRevision: () => extractVersionRevision,
37041
+ findEndpoint: () => findEndpoint,
35756
37042
  firstLangStringSetText: () => firstLangStringSetText,
35757
37043
  getEquivalentEclassSemanticIds: () => getEquivalentEclassSemanticIds,
35758
37044
  getEquivalentIriSemanticIds: () => getEquivalentIriSemanticIds,
35759
37045
  getKeyTypeAbbreviation: () => getKeyTypeAbbreviation,
37046
+ getQueryEndpoints: () => getQueryEndpoints,
35760
37047
  getSubmodelElementByIdShort: () => getSubmodelElementByIdShort,
35761
37048
  getSubmodelElementBySemanticId: () => getSubmodelElementBySemanticId,
35762
37049
  getSubmodelElementsByIdShort: () => getSubmodelElementsByIdShort,
35763
37050
  getSubmodelElementsBySemanticId: () => getSubmodelElementsBySemanticId,
35764
37051
  hasValue: () => hasValue,
37052
+ isRepositoryEndpoint: () => isRepositoryEndpoint,
35765
37053
  keyTypes: () => keyTypes,
35766
37054
  nameToDisplay: () => nameToDisplay,
37055
+ supportsQuery: () => supportsQuery,
35767
37056
  valueToDisplay: () => valueToDisplay
35768
37057
  });
35769
37058
  //#endregion
35770
- export { AasDiscoveryClient, AasDiscoveryService_exports as AasDiscoveryService, AasRegistryClient, AasRegistryService_exports as AasRegistryService, AasRepositoryClient, AasRepositoryService_exports as AasRepositoryService, AasService, AasxFileClient, AasxFileService_exports as AasxFileService, AssetAdministrationShellDescriptor, BASE_PATH, BaSyxEnvironment, BaseAPI, BlobApiResponse, COLLECTION_FORMATS, ConceptDescriptionRepositoryClient, ConceptDescriptionRepositoryService_exports as ConceptDescriptionRepositoryService, Configuration, DefaultConfig, DescriptorUtils_exports as DescriptorUtils, FetchError, JSONApiResponse, KeyTypesUtil_exports as KeyTypesUtil, lib_exports as Lib, MultiLanguagePropertyUtils_exports as MultiLanguagePropertyUtils, ProtocolInformationSecurityAttributesTypeEnum, ReferableUtils_exports as ReferableUtils, ReferenceUtil_exports as ReferenceUtil, RequiredError, ResponseError, SemanticIdUtils_exports as SemanticIdUtils, SubmodelDescriptor, SubmodelRegistryClient, SubmodelRegistryService_exports as SubmodelRegistryService, SubmodelRepositoryClient, SubmodelRepositoryService_exports as SubmodelRepositoryService, SubmodelService, TextApiResponse, utils_exports as Utils, VoidApiResponse, applyDefaults, assetAdministrationShellDescriptorFromJsonable, base64Decode, base64Encode, canConsumeForm, checkIdShort, checkSemanticId, checkSemanticIdEclassIrdi, checkSemanticIdEclassIrdiUrl, checkSemanticIdIecCdd, checkSemanticIdIri, convertApiAasDescriptorToCoreAasDescriptor, convertApiAasToCoreAas, convertApiAssetIdToCoreAssetId, convertApiAssetInformationToCoreAssetInformation, convertApiCDToCoreCD, convertApiReferenceToCoreReference, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreAasDescriptorToApiAasDescriptor, convertCoreAasToApiAas, convertCoreAssetIdToApiAssetId, convertCoreAssetInformationToApiAssetInformation, convertCoreCDToApiCD, convertCoreReferenceToApiReference, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, descriptionToDisplay, deserializeXml, endpointFromJsonable, exists, extractEndpointHref, extractId, extractVersionRevision, firstLangStringSetText, getEquivalentEclassSemanticIds, getEquivalentIriSemanticIds, getKeyTypeAbbreviation, getSubmodelElementByIdShort, getSubmodelElementBySemanticId, getSubmodelElementsByIdShort, getSubmodelElementsBySemanticId, handleApiError, hasValue, keyTypes, nameToDisplay, protocolInformationFromJsonable, querystring, serializeXml, submodelDescriptorFromJsonable, toJsonableAssetAdministrationShellDescriptor, toJsonableEndpoint, toJsonableProtocolInformation, toJsonableSecurityAttribute, toJsonableSubmodelDescriptor, valueToDisplay };
37059
+ export { AasDiscoveryClient, AasDiscoveryService_exports as AasDiscoveryService, AasRegistryClient, AasRegistryService_exports as AasRegistryService, AasRepositoryClient, AasRepositoryService_exports as AasRepositoryService, AasService, AasxFileClient, AasxFileService_exports as AasxFileService, AndExpression, AssetAdministrationShellDescriptor, AttributeOperand, BASE_PATH, BaSyxEnvironment, BaseAPI, BlobApiResponse, BooleanCast, BooleanLiteral, COLLECTION_FORMATS, ClaimAttribute, ConceptDescriptionRepositoryClient, ConceptDescriptionRepositoryService_exports as ConceptDescriptionRepositoryService, Configuration, ContainsComparison, DateTimeAttributeItem, DateTimeAttributeOperand, DateTimeCast, DateTimeGlobalAttributeKind, DateTimeLiteral, DayOfMonth, DayOfWeek, DefaultConfig, DescriptorUtils_exports as DescriptorUtils, EndsWithComparison, EqualComparison, FetchError, FieldOperand, GlobalAttribute, GlobalAttributeKind, GreaterThanComparison, GreaterThanOrEqualComparison, HexCast, HexLiteral, JSONApiResponse, KeyTypesUtil_exports as KeyTypesUtil, LessThanComparison, LessThanOrEqualComparison, lib_exports as Lib, MatchClause, Month, MultiLanguagePropertyUtils_exports as MultiLanguagePropertyUtils, NotEqualComparison, NotExpression, NumberCast, NumberLiteral, OrExpression, ProtocolInformationSecurityAttributesTypeEnum, Query, QueryFilter, QuerySelect, ReferableUtils_exports as ReferableUtils, ReferenceAttribute, ReferenceUtil_exports as ReferenceUtil, RegexComparison, RequiredError, ResponseError, SemanticIdUtils_exports as SemanticIdUtils, ServiceDescriptionUtils_exports as ServiceDescriptionUtils, StartsWithComparison, StringCast, StringLiteral, SubmodelDescriptor, SubmodelRegistryClient, SubmodelRegistryService_exports as SubmodelRegistryService, SubmodelRepositoryClient, SubmodelRepositoryService_exports as SubmodelRepositoryService, SubmodelService, TextApiResponse, TimeCast, TimeLiteral, utils_exports as Utils, VoidApiResponse, Year, applyDefaults, assetAdministrationShellDescriptorFromJsonable, base64Decode, base64Encode, canConsumeForm, checkIdShort, checkSemanticId, checkSemanticIdEclassIrdi, checkSemanticIdEclassIrdiUrl, checkSemanticIdIecCdd, checkSemanticIdIri, convertApiAasDescriptorToCoreAasDescriptor, convertApiAasToCoreAas, convertApiAssetIdToCoreAssetId, convertApiAssetInformationToCoreAssetInformation, convertApiCDToCoreCD, convertApiReferenceToCoreReference, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreAasDescriptorToApiAasDescriptor, convertCoreAasToApiAas, convertCoreAssetIdToApiAssetId, convertCoreAssetInformationToApiAssetInformation, convertCoreCDToApiCD, convertCoreReferenceToApiReference, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, descriptionToDisplay, deserializeXml, endpointFromJsonable, exists, extractEndpointHref, extractId, extractVersionRevision, findEndpoint, firstLangStringSetText, getEquivalentEclassSemanticIds, getEquivalentIriSemanticIds, getKeyTypeAbbreviation, getQueryEndpoints, getSubmodelElementByIdShort, getSubmodelElementBySemanticId, getSubmodelElementsByIdShort, getSubmodelElementsBySemanticId, handleApiError, hasValue, isRepositoryEndpoint, keyTypes, nameToDisplay, protocolInformationFromJsonable, queryFromJsonable, querystring, serializeXml, submodelDescriptorFromJsonable, supportsQuery, toJsonableAssetAdministrationShellDescriptor, toJsonableEndpoint, toJsonableProtocolInformation, toJsonableQuery, toJsonableSecurityAttribute, toJsonableSubmodelDescriptor, valueToDisplay };
35771
37060
 
35772
37061
  //# sourceMappingURL=index.mjs.map