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