basyx-typescript-sdk 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +68 -1
  2. package/bundle/index.cjs +1421 -91
  3. package/bundle/index.cjs.map +1 -1
  4. package/bundle/index.mjs +1353 -92
  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 +20 -0
  9. package/dist/clients/AasRepositoryClient.js +40 -0
  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 +20 -0
  15. package/dist/clients/SubmodelRepositoryClient.js +40 -0
  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 -1
  33. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +29 -0
  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/errorHandler.js +9 -4
  39. package/dist/lib/index.d.ts +1 -0
  40. package/dist/lib/index.js +2 -0
  41. package/dist/lib/queryJsonization.d.ts +17 -0
  42. package/dist/lib/queryJsonization.js +309 -0
  43. package/dist/lib/queryRequests.d.ts +24 -0
  44. package/dist/lib/queryRequests.js +44 -0
  45. package/dist/models/Query.d.ts +378 -0
  46. package/dist/models/Query.js +430 -0
  47. package/dist/models/QueryResult.d.ts +22 -0
  48. package/dist/models/QueryResult.js +1 -0
  49. package/dist/models/index.d.ts +2 -0
  50. package/dist/models/index.js +2 -0
  51. package/dist/services/AasService.d.ts +15 -4
  52. package/dist/services/AasService.js +38 -40
  53. package/dist/services/SubmodelService.d.ts +9 -8
  54. package/dist/services/SubmodelService.js +17 -34
  55. package/dist/services/index.d.ts +1 -0
  56. package/dist/utils/DescriptorUtils.d.ts +27 -1
  57. package/dist/utils/DescriptorUtils.js +65 -27
  58. package/dist/utils/ServiceDescriptionUtils.d.ts +30 -0
  59. package/dist/utils/ServiceDescriptionUtils.js +43 -0
  60. package/dist/utils/index.d.ts +2 -0
  61. package/dist/utils/index.js +2 -0
  62. 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
2
  import type { ApiResult, ConditionalApiResult } 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
  *
@@ -6,6 +6,7 @@ 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 { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
9
10
  export class AasRepositoryClient {
10
11
  static requireIdentifier(value, field) {
11
12
  if (value === null || value === undefined || value.trim() === '') {
@@ -70,6 +71,45 @@ export class AasRepositoryClient {
70
71
  };
71
72
  }
72
73
  }
74
+ /**
75
+ * Returns all Asset Administration Shells 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('$aas#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 queryAssetAdministrationShells(options) {
87
+ const { configuration, query, limit, cursor } = options;
88
+ try {
89
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
90
+ const response = await apiInstance.queryAssetAdministrationShellsRaw({
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, 'AssetAdministrationShell', convertApiAasToCoreAas),
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: AasRepositoryClient.extractStatusCode(err, customError),
109
+ ...getConditionalErrorFields(err),
110
+ };
111
+ }
112
+ }
73
113
  /**
74
114
  * Returns References to all Asset Administration Shells
75
115
  *
@@ -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
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 { 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
  *
@@ -5,6 +5,7 @@ import { base64Encode } from '../lib/base64Url';
5
5
  import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
6
6
  import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
7
7
  import { handleApiError } from '../lib/errorHandler';
8
+ import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
8
9
  //import { SubmodelElement } from 'src/generated/SubmodelRepositoryService';
9
10
  export class SubmodelRepositoryClient {
10
11
  static requireIdentifier(value, field) {
@@ -74,6 +75,45 @@ export class SubmodelRepositoryClient {
74
75
  };
75
76
  }
76
77
  }
78
+ /**
79
+ * Returns all Submodels that conform to the query (AAS Query Language)
80
+ *
81
+ * @param options Object containing:
82
+ * - configuration: The http request options
83
+ * - query: The query, e.g. `new Query(new EqualComparison([new FieldOperand('$sm#idShort'), new StringLiteral('Nameplate')]))`
84
+ * - limit?: The maximum number of elements in the response array
85
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
86
+ *
87
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
88
+ * `data.resultType` is `'Identifier'` with `result: string[]` if the query selects `QuerySelect.Id`.
89
+ */
90
+ async querySubmodels(options) {
91
+ const { configuration, query, limit, cursor } = options;
92
+ try {
93
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
94
+ const response = await apiInstance.querySubmodelsRaw({
95
+ query: toQueryRequestBody(query),
96
+ limit: limit,
97
+ cursor: cursor,
98
+ });
99
+ const result = await response.value();
100
+ return {
101
+ success: true,
102
+ data: convertQueryResult(result, query, 'Submodel', convertApiSubmodelToCoreSubmodel),
103
+ statusCode: response.raw.status,
104
+ etag: getEtag(response.raw),
105
+ };
106
+ }
107
+ catch (err) {
108
+ const customError = await handleApiError(err);
109
+ return {
110
+ success: false,
111
+ error: customError,
112
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
113
+ ...getConditionalErrorFields(err),
114
+ };
115
+ }
116
+ }
77
117
  /**
78
118
  * Returns all Submodels in metadata representation
79
119
  *
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../../runtime';
13
- import type { AssetAdministrationShellDescriptor, AssetKind, GetAssetAdministrationShellDescriptorsResult, GetSubmodelDescriptorsResult, SubmodelDescriptor } from '../models/index';
13
+ import type { AssetAdministrationShellDescriptor, AssetKind, GetAssetAdministrationShellDescriptorsResult, GetSubmodelDescriptorsResult, Query, QueryResultAssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/index';
14
14
  export interface DeleteAssetAdministrationShellDescriptorByIdRequest {
15
15
  aasIdentifier: string;
16
16
  }
@@ -52,6 +52,11 @@ export interface PutSubmodelDescriptorByIdThroughSuperpathRequest {
52
52
  submodelIdentifier: string;
53
53
  submodelDescriptor: SubmodelDescriptor;
54
54
  }
55
+ export interface QueryAssetAdministrationShellDescriptorsRequest {
56
+ limit?: number;
57
+ cursor?: string;
58
+ query?: Query;
59
+ }
55
60
  /**
56
61
  *
57
62
  */
@@ -136,4 +141,12 @@ export declare class AssetAdministrationShellRegistryAPIApi extends runtime.Base
136
141
  * Creates or updates an existing Submodel Descriptor
137
142
  */
138
143
  putSubmodelDescriptorByIdThroughSuperpath(requestParameters: PutSubmodelDescriptorByIdThroughSuperpathRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmodelDescriptor | null | undefined>;
144
+ /**
145
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
146
+ */
147
+ queryAssetAdministrationShellDescriptorsRaw(requestParameters: QueryAssetAdministrationShellDescriptorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<QueryResultAssetAdministrationShellDescriptor>>;
148
+ /**
149
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
150
+ */
151
+ queryAssetAdministrationShellDescriptors(requestParameters?: QueryAssetAdministrationShellDescriptorsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<QueryResultAssetAdministrationShellDescriptor>;
139
152
  }
@@ -309,4 +309,33 @@ export class AssetAdministrationShellRegistryAPIApi extends runtime.BaseAPI {
309
309
  return await response.value();
310
310
  }
311
311
  }
312
+ /**
313
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
314
+ */
315
+ async queryAssetAdministrationShellDescriptorsRaw(requestParameters, initOverrides) {
316
+ const queryParameters = {};
317
+ if (requestParameters['limit'] != null) {
318
+ queryParameters['limit'] = requestParameters['limit'];
319
+ }
320
+ if (requestParameters['cursor'] != null) {
321
+ queryParameters['cursor'] = requestParameters['cursor'];
322
+ }
323
+ const headerParameters = {};
324
+ headerParameters['Content-Type'] = 'application/json';
325
+ const response = await this.request({
326
+ path: `/query/shell-descriptors`,
327
+ method: 'POST',
328
+ headers: headerParameters,
329
+ query: queryParameters,
330
+ body: requestParameters['query'],
331
+ }, initOverrides);
332
+ return new runtime.JSONApiResponse(response);
333
+ }
334
+ /**
335
+ * Returns all Asset Administration Shell Descriptors that confirm to the input query
336
+ */
337
+ async queryAssetAdministrationShellDescriptors(requestParameters = {}, initOverrides) {
338
+ const response = await this.queryAssetAdministrationShellDescriptorsRaw(requestParameters, initOverrides);
339
+ return await response.value();
340
+ }
312
341
  }