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
@@ -1,4 +1,6 @@
1
1
  import type { ApiResult, ConditionalApiResult } from '../models/api';
2
+ import type { Query } from '../models/Query';
3
+ import type { QueryResult } from '../models/QueryResult';
2
4
  import { AasRegistryService } from '../generated';
3
5
  import { Configuration } from '../generated/runtime';
4
6
  import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
@@ -27,6 +29,24 @@ export declare class AasRegistryClient {
27
29
  pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
28
30
  result: AssetAdministrationShellDescriptor[];
29
31
  }, AasRegistryService.Result>>;
32
+ /**
33
+ * Returns all Asset Administration Shell Descriptors that conform to the query (AAS Query Language)
34
+ *
35
+ * @param options Object containing:
36
+ * - configuration: The http request options
37
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aasdesc#idShort'), new StringLiteral('Robot')]))`
38
+ * - limit?: The maximum number of elements in the response array
39
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
40
+ *
41
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
42
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
43
+ */
44
+ queryAssetAdministrationShellDescriptors(options: {
45
+ configuration: Configuration;
46
+ query: Query;
47
+ limit?: number;
48
+ cursor?: string;
49
+ }): Promise<ApiResult<QueryResult<AssetAdministrationShellDescriptor, 'AssetAdministrationShellDescriptor', AasRegistryService.PagedResultPagingMetadata>, AasRegistryService.Result>>;
30
50
  /**
31
51
  * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
32
52
  *
@@ -5,6 +5,7 @@ import { base64Encode } from '../lib/base64Url';
5
5
  import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
6
6
  import { convertApiAasDescriptorToCoreAasDescriptor, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreAasDescriptorToApiAasDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
7
7
  import { handleApiError } from '../lib/errorHandler';
8
+ import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
8
9
  export class AasRegistryClient {
9
10
  static requireIdentifier(value, field) {
10
11
  if (value === null || value === undefined || value.trim() === '') {
@@ -70,6 +71,45 @@ export class AasRegistryClient {
70
71
  };
71
72
  }
72
73
  }
74
+ /**
75
+ * Returns all Asset Administration Shell Descriptors that conform to the query (AAS Query Language)
76
+ *
77
+ * @param options Object containing:
78
+ * - configuration: The http request options
79
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aasdesc#idShort'), new StringLiteral('Robot')]))`
80
+ * - limit?: The maximum number of elements in the response array
81
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
82
+ *
83
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
84
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
85
+ */
86
+ async queryAssetAdministrationShellDescriptors(options) {
87
+ const { configuration, query, limit, cursor } = options;
88
+ try {
89
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
90
+ const response = await apiInstance.queryAssetAdministrationShellDescriptorsRaw({
91
+ query: toQueryRequestBody(query),
92
+ limit: limit,
93
+ cursor: cursor,
94
+ });
95
+ const result = await response.value();
96
+ return {
97
+ success: true,
98
+ data: convertQueryResult(result, query, 'AssetAdministrationShellDescriptor', convertApiAasDescriptorToCoreAasDescriptor),
99
+ statusCode: response.raw.status,
100
+ etag: getEtag(response.raw),
101
+ };
102
+ }
103
+ catch (err) {
104
+ const customError = await handleApiError(err);
105
+ return {
106
+ success: false,
107
+ error: customError,
108
+ statusCode: AasRegistryClient.extractStatusCode(err, customError),
109
+ ...getConditionalErrorFields(err),
110
+ };
111
+ }
112
+ }
73
113
  /**
74
114
  * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
75
115
  *
@@ -1,6 +1,8 @@
1
1
  import type { AssetAdministrationShell, AssetInformation, ISubmodelElement, Reference, Submodel } from '@aas-core-works/aas-core3.1-typescript/types';
2
- import type { ApiResult, ConditionalApiResult } from '../models/api';
2
+ import type { ApiResult, ConditionalApiResult, OperationHandle } from '../models/api';
3
3
  import type { AssetId } from '../models/AssetId';
4
+ import type { Query } from '../models/Query';
5
+ import type { QueryResult } from '../models/QueryResult';
4
6
  import { AasRepositoryService } from '../generated';
5
7
  import { Configuration } from '../generated/runtime';
6
8
  export declare class AasRepositoryClient {
@@ -28,6 +30,24 @@ export declare class AasRepositoryClient {
28
30
  pagedResult: AasRepositoryService.PagedResultPagingMetadata | undefined;
29
31
  result: AssetAdministrationShell[];
30
32
  }, AasRepositoryService.Result>>;
33
+ /**
34
+ * Returns all Asset Administration Shells that conform to the query (AAS Query Language)
35
+ *
36
+ * @param options Object containing:
37
+ * - configuration: The http request options
38
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aas#idShort'), new StringLiteral('Robot')]))`
39
+ * - limit?: The maximum number of elements in the response array
40
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
41
+ *
42
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
43
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
44
+ */
45
+ queryAssetAdministrationShells(options: {
46
+ configuration: Configuration;
47
+ query: Query;
48
+ limit?: number;
49
+ cursor?: string;
50
+ }): Promise<ApiResult<QueryResult<AssetAdministrationShell, 'AssetAdministrationShell', AasRepositoryService.PagedResultPagingMetadata>, AasRepositoryService.Result>>;
31
51
  /**
32
52
  * Returns References to all Asset Administration Shells
33
53
  *
@@ -1018,6 +1038,10 @@ export declare class AasRepositoryClient {
1018
1038
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1019
1039
  *
1020
1040
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1041
+ * `data` is the handle of the invocation, taken from the `Location` header, for
1042
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
1043
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
1044
+ * `Access-Control-Expose-Headers`).
1021
1045
  */
1022
1046
  invokeOperationAsyncAasRepository(options: {
1023
1047
  configuration: Configuration;
@@ -1026,7 +1050,7 @@ export declare class AasRepositoryClient {
1026
1050
  idShortPath: string;
1027
1051
  operationRequest: AasRepositoryService.OperationRequest;
1028
1052
  ifMatch?: string;
1029
- }): Promise<ApiResult<void, AasRepositoryService.Result>>;
1053
+ }): Promise<ApiResult<OperationHandle | undefined, AasRepositoryService.Result>>;
1030
1054
  /**
1031
1055
  * Asynchronously invokes an Operation at a specified path
1032
1056
  *
@@ -1039,6 +1063,10 @@ export declare class AasRepositoryClient {
1039
1063
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1040
1064
  *
1041
1065
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1066
+ * `data` is the handle of the invocation, taken from the `Location` header, for
1067
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
1068
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
1069
+ * `Access-Control-Expose-Headers`).
1042
1070
  */
1043
1071
  invokeOperationAsyncValueOnlyAasRepository(options: {
1044
1072
  configuration: Configuration;
@@ -1047,7 +1075,7 @@ export declare class AasRepositoryClient {
1047
1075
  idShortPath: string;
1048
1076
  operationRequestValueOnly: AasRepositoryService.OperationRequestValueOnly;
1049
1077
  ifMatch?: string;
1050
- }): Promise<ApiResult<void, AasRepositoryService.Result>>;
1078
+ }): Promise<ApiResult<OperationHandle | undefined, AasRepositoryService.Result>>;
1051
1079
  /**
1052
1080
  * Returns the Operation status of an asynchronous invoked Operation
1053
1081
  *
@@ -6,6 +6,8 @@ import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib
6
6
  import { convertApiAasToCoreAas, convertApiAssetInformationToCoreAssetInformation, convertApiReferenceToCoreReference, convertCoreAasToApiAas, convertCoreAssetInformationToApiAssetInformation, convertCoreReferenceToApiReference, } from '../lib/convertAasTypes';
7
7
  import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
8
8
  import { handleApiError } from '../lib/errorHandler';
9
+ import { getOperationHandle } from '../lib/operationHandle';
10
+ import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
9
11
  export class AasRepositoryClient {
10
12
  static requireIdentifier(value, field) {
11
13
  if (value === null || value === undefined || value.trim() === '') {
@@ -70,6 +72,45 @@ export class AasRepositoryClient {
70
72
  };
71
73
  }
72
74
  }
75
+ /**
76
+ * Returns all Asset Administration Shells that conform to the query (AAS Query Language)
77
+ *
78
+ * @param options Object containing:
79
+ * - configuration: The http request options
80
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$aas#idShort'), new StringLiteral('Robot')]))`
81
+ * - limit?: The maximum number of elements in the response array
82
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
83
+ *
84
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
85
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
86
+ */
87
+ async queryAssetAdministrationShells(options) {
88
+ const { configuration, query, limit, cursor } = options;
89
+ try {
90
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
91
+ const response = await apiInstance.queryAssetAdministrationShellsRaw({
92
+ query: toQueryRequestBody(query),
93
+ limit: limit,
94
+ cursor: cursor,
95
+ });
96
+ const result = await response.value();
97
+ return {
98
+ success: true,
99
+ data: convertQueryResult(result, query, 'AssetAdministrationShell', convertApiAasToCoreAas),
100
+ statusCode: response.raw.status,
101
+ etag: getEtag(response.raw),
102
+ };
103
+ }
104
+ catch (err) {
105
+ const customError = await handleApiError(err);
106
+ return {
107
+ success: false,
108
+ error: customError,
109
+ statusCode: AasRepositoryClient.extractStatusCode(err, customError),
110
+ ...getConditionalErrorFields(err),
111
+ };
112
+ }
113
+ }
73
114
  /**
74
115
  * Returns References to all Asset Administration Shells
75
116
  *
@@ -2031,6 +2072,10 @@ export class AasRepositoryClient {
2031
2072
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
2032
2073
  *
2033
2074
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
2075
+ * `data` is the handle of the invocation, taken from the `Location` header, for
2076
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
2077
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
2078
+ * `Access-Control-Expose-Headers`).
2034
2079
  */
2035
2080
  async invokeOperationAsyncAasRepository(options) {
2036
2081
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
@@ -2044,8 +2089,12 @@ export class AasRepositoryClient {
2044
2089
  idShortPath: idShortPath,
2045
2090
  operationRequest: operationRequest,
2046
2091
  });
2047
- const result = await response.value();
2048
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
2092
+ return {
2093
+ success: true,
2094
+ data: getOperationHandle(response.raw),
2095
+ statusCode: response.raw.status,
2096
+ etag: getEtag(response.raw),
2097
+ };
2049
2098
  }
2050
2099
  catch (err) {
2051
2100
  const customError = await handleApiError(err);
@@ -2069,6 +2118,10 @@ export class AasRepositoryClient {
2069
2118
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
2070
2119
  *
2071
2120
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
2121
+ * `data` is the handle of the invocation, taken from the `Location` header, for
2122
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
2123
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
2124
+ * `Access-Control-Expose-Headers`).
2072
2125
  */
2073
2126
  async invokeOperationAsyncValueOnlyAasRepository(options) {
2074
2127
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
@@ -2082,8 +2135,12 @@ export class AasRepositoryClient {
2082
2135
  idShortPath: idShortPath,
2083
2136
  operationRequestValueOnly: operationRequestValueOnly,
2084
2137
  });
2085
- const result = await response.value();
2086
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
2138
+ return {
2139
+ success: true,
2140
+ data: getOperationHandle(response.raw),
2141
+ statusCode: response.raw.status,
2142
+ etag: getEtag(response.raw),
2143
+ };
2087
2144
  }
2088
2145
  catch (err) {
2089
2146
  const customError = await handleApiError(err);
@@ -1,5 +1,7 @@
1
1
  import type { ConceptDescription } from '@aas-core-works/aas-core3.1-typescript/types';
2
2
  import type { ApiResult, ConditionalApiResult } from '../models/api';
3
+ import type { Query } from '../models/Query';
4
+ import type { QueryResult } from '../models/QueryResult';
3
5
  import { ConceptDescriptionRepositoryService } from '../generated';
4
6
  import { Configuration } from '../generated/runtime';
5
7
  export declare class ConceptDescriptionRepositoryClient {
@@ -78,6 +80,24 @@ export declare class ConceptDescriptionRepositoryClient {
78
80
  pagedResult: ConceptDescriptionRepositoryService.PagedResultPagingMetadata | undefined;
79
81
  result: ConceptDescription[];
80
82
  }, ConceptDescriptionRepositoryService.Result>>;
83
+ /**
84
+ * Returns all Concept Descriptions that conform to the query (AAS Query Language)
85
+ *
86
+ * @param options Object containing:
87
+ * - configuration: The http request options
88
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$cd#idShort'), new StringLiteral('Voltage')]))`
89
+ * - limit?: The maximum number of elements in the response array
90
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
91
+ *
92
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
93
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
94
+ */
95
+ queryConceptDescriptions(options: {
96
+ configuration: Configuration;
97
+ query: Query;
98
+ limit?: number;
99
+ cursor?: string;
100
+ }): Promise<ApiResult<QueryResult<ConceptDescription, 'ConceptDescription', ConceptDescriptionRepositoryService.PagedResultPagingMetadata>, ConceptDescriptionRepositoryService.Result>>;
81
101
  /**
82
102
  * Creates a new Concept Description
83
103
  *
@@ -5,6 +5,7 @@ import { base64Encode } from '../lib/base64Url';
5
5
  import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
6
6
  import { convertApiCDToCoreCD, convertCoreCDToApiCD } from '../lib/convertConceptDescriptionTypes';
7
7
  import { handleApiError } from '../lib/errorHandler';
8
+ import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
8
9
  export class ConceptDescriptionRepositoryClient {
9
10
  static requireIdentifier(value, field) {
10
11
  if (value === null || value === undefined || value.trim() === '') {
@@ -186,6 +187,45 @@ export class ConceptDescriptionRepositoryClient {
186
187
  };
187
188
  }
188
189
  }
190
+ /**
191
+ * Returns all Concept Descriptions that conform to the query (AAS Query Language)
192
+ *
193
+ * @param options Object containing:
194
+ * - configuration: The http request options
195
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$cd#idShort'), new StringLiteral('Voltage')]))`
196
+ * - limit?: The maximum number of elements in the response array
197
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
198
+ *
199
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
200
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
201
+ */
202
+ async queryConceptDescriptions(options) {
203
+ const { configuration, query, limit, cursor } = options;
204
+ try {
205
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
206
+ const response = await apiInstance.queryConceptDescriptionsRaw({
207
+ query: toQueryRequestBody(query),
208
+ limit: limit,
209
+ cursor: cursor,
210
+ });
211
+ const result = await response.value();
212
+ return {
213
+ success: true,
214
+ data: convertQueryResult(result, query, 'ConceptDescription', convertApiCDToCoreCD),
215
+ statusCode: response.raw.status,
216
+ etag: getEtag(response.raw),
217
+ };
218
+ }
219
+ catch (err) {
220
+ const customError = await handleApiError(err);
221
+ return {
222
+ success: false,
223
+ error: customError,
224
+ statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
225
+ ...getConditionalErrorFields(err),
226
+ };
227
+ }
228
+ }
189
229
  /**
190
230
  * Creates a new Concept Description
191
231
  *
@@ -1,4 +1,6 @@
1
1
  import type { ApiResult, ConditionalApiResult } from '../models/api';
2
+ import type { Query } from '../models/Query';
3
+ import type { QueryResult } from '../models/QueryResult';
2
4
  import { SubmodelRegistryService } from '../generated';
3
5
  import { Configuration } from '../generated/runtime';
4
6
  import { SubmodelDescriptor } from '../models/Descriptors';
@@ -23,6 +25,24 @@ export declare class SubmodelRegistryClient {
23
25
  pagedResult: SubmodelRegistryService.PagedResultPagingMetadata | undefined;
24
26
  result: SubmodelDescriptor[];
25
27
  }, SubmodelRegistryService.Result>>;
28
+ /**
29
+ * Returns all Submodel Descriptors that conform to the query (AAS Query Language)
30
+ *
31
+ * @param options Object containing:
32
+ * - configuration: The http request options
33
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$smdesc#idShort'), new StringLiteral('Nameplate')]))`
34
+ * - limit?: The maximum number of elements in the response array
35
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
36
+ *
37
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
38
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
39
+ */
40
+ querySubmodelDescriptors(options: {
41
+ configuration: Configuration;
42
+ query: Query;
43
+ limit?: number;
44
+ cursor?: string;
45
+ }): Promise<ApiResult<QueryResult<SubmodelDescriptor, 'SubmodelDescriptor', SubmodelRegistryService.PagedResultPagingMetadata>, SubmodelRegistryService.Result>>;
26
46
  /**
27
47
  * Creates a new Submodel Descriptor, i.e. registers a Submodel
28
48
  *
@@ -5,6 +5,7 @@ import { base64Encode } from '../lib/base64Url';
5
5
  import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
6
6
  import { convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
7
7
  import { handleApiError } from '../lib/errorHandler';
8
+ import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
8
9
  export class SubmodelRegistryClient {
9
10
  static requireIdentifier(value, field) {
10
11
  if (value === null || value === undefined || value.trim() === '') {
@@ -65,6 +66,45 @@ export class SubmodelRegistryClient {
65
66
  };
66
67
  }
67
68
  }
69
+ /**
70
+ * Returns all Submodel Descriptors that conform to the query (AAS Query Language)
71
+ *
72
+ * @param options Object containing:
73
+ * - configuration: The http request options
74
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$smdesc#idShort'), new StringLiteral('Nameplate')]))`
75
+ * - limit?: The maximum number of elements in the response array
76
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
77
+ *
78
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
79
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
80
+ */
81
+ async querySubmodelDescriptors(options) {
82
+ const { configuration, query, limit, cursor } = options;
83
+ try {
84
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
85
+ const response = await apiInstance.querySubmodelDescriptorsRaw({
86
+ query: toQueryRequestBody(query),
87
+ limit: limit,
88
+ cursor: cursor,
89
+ });
90
+ const result = await response.value();
91
+ return {
92
+ success: true,
93
+ data: convertQueryResult(result, query, 'SubmodelDescriptor', convertApiSubmodelDescriptorToCoreSubmodelDescriptor),
94
+ statusCode: response.raw.status,
95
+ etag: getEtag(response.raw),
96
+ };
97
+ }
98
+ catch (err) {
99
+ const customError = await handleApiError(err);
100
+ return {
101
+ success: false,
102
+ error: customError,
103
+ statusCode: SubmodelRegistryClient.extractStatusCode(err, customError),
104
+ ...getConditionalErrorFields(err),
105
+ };
106
+ }
107
+ }
68
108
  /**
69
109
  * Creates a new Submodel Descriptor, i.e. registers a Submodel
70
110
  *
@@ -1,5 +1,7 @@
1
1
  import type { ISubmodelElement, Submodel } from '@aas-core-works/aas-core3.1-typescript/types';
2
- import type { ApiResult, ConditionalApiResult } from '../models/api';
2
+ import type { ApiResult, ConditionalApiResult, OperationHandle } from '../models/api';
3
+ import type { Query } from '../models/Query';
4
+ import type { QueryResult } from '../models/QueryResult';
3
5
  import { SubmodelRepositoryService } from '../generated';
4
6
  import { Configuration } from '../generated/runtime';
5
7
  export declare class SubmodelRepositoryClient {
@@ -31,6 +33,24 @@ export declare class SubmodelRepositoryClient {
31
33
  pagedResult: SubmodelRepositoryService.PagedResultPagingMetadata | undefined;
32
34
  result: Submodel[];
33
35
  }, SubmodelRepositoryService.Result>>;
36
+ /**
37
+ * Returns all Submodels that conform to the query (AAS Query Language)
38
+ *
39
+ * @param options Object containing:
40
+ * - configuration: The http request options
41
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$sm#idShort'), new StringLiteral('Nameplate')]))`
42
+ * - limit?: The maximum number of elements in the response array
43
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
44
+ *
45
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
46
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
47
+ */
48
+ querySubmodels(options: {
49
+ configuration: Configuration;
50
+ query: Query;
51
+ limit?: number;
52
+ cursor?: string;
53
+ }): Promise<ApiResult<QueryResult<Submodel, 'Submodel', SubmodelRepositoryService.PagedResultPagingMetadata>, SubmodelRepositoryService.Result>>;
34
54
  /**
35
55
  * Returns all Submodels in metadata representation
36
56
  *
@@ -727,7 +747,6 @@ export declare class SubmodelRepositoryClient {
727
747
  *
728
748
  * @param options Object containing:
729
749
  * - configuration: The http request options.
730
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
731
750
  * - submodelIdentifier: The Submodel’s unique id
732
751
  * - idShortPath: IdShort path to the submodel element (dot-separated)
733
752
  * - operationRequestValueOnly: Operation request object
@@ -737,7 +756,8 @@ export declare class SubmodelRepositoryClient {
737
756
  */
738
757
  postInvokeOperationValueOnly(options: {
739
758
  configuration: Configuration;
740
- aasIdentifier: string;
759
+ /** @deprecated Not part of the Submodel Repository API and ignored */
760
+ aasIdentifier?: string;
741
761
  submodelIdentifier: string;
742
762
  idShortPath: string;
743
763
  operationRequestValueOnly: SubmodelRepositoryService.OperationRequestValueOnly;
@@ -754,6 +774,9 @@ export declare class SubmodelRepositoryClient {
754
774
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
755
775
  *
756
776
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
777
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
778
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
779
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
757
780
  */
758
781
  postInvokeOperationAsync(options: {
759
782
  configuration: Configuration;
@@ -761,28 +784,31 @@ export declare class SubmodelRepositoryClient {
761
784
  idShortPath: string;
762
785
  operationRequest: SubmodelRepositoryService.OperationRequest;
763
786
  ifMatch?: string;
764
- }): Promise<ApiResult<void, SubmodelRepositoryService.Result>>;
787
+ }): Promise<ApiResult<OperationHandle | undefined, SubmodelRepositoryService.Result>>;
765
788
  /**
766
789
  * Asynchronously invokes an Operation at a specified path
767
790
  *
768
791
  * @param options Object containing:
769
792
  * - configuration: The http request options.
770
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
771
793
  * - submodelIdentifier: The Submodel’s unique id
772
794
  * - idShortPath: IdShort path to the submodel element (dot-separated)
773
795
  * - operationRequestValueOnly: Operation request object
774
796
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
775
797
  *
776
798
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
799
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
800
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
801
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
777
802
  */
778
803
  postInvokeOperationAsyncValueOnly(options: {
779
804
  configuration: Configuration;
780
- aasIdentifier: string;
805
+ /** @deprecated Not part of the Submodel Repository API and ignored */
806
+ aasIdentifier?: string;
781
807
  submodelIdentifier: string;
782
808
  idShortPath: string;
783
809
  operationRequestValueOnly: SubmodelRepositoryService.OperationRequestValueOnly;
784
810
  ifMatch?: string;
785
- }): Promise<ApiResult<void, SubmodelRepositoryService.Result>>;
811
+ }): Promise<ApiResult<OperationHandle | undefined, SubmodelRepositoryService.Result>>;
786
812
  /**
787
813
  * Returns status of an asynchronously invoked operation
788
814
  *