basyx-typescript-sdk 2.2.4 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -0
- package/bundle/index.cjs +2479 -1814
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +2479 -1814
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasDiscoveryClient.d.ts +3 -2
- package/dist/clients/AasDiscoveryClient.js +78 -20
- package/dist/clients/AasRegistryClient.d.ts +4 -2
- package/dist/clients/AasRegistryClient.js +153 -45
- package/dist/clients/AasRepositoryClient.d.ts +73 -16
- package/dist/clients/AasRepositoryClient.js +682 -263
- package/dist/clients/AasxFileClient.d.ts +18 -0
- package/dist/clients/AasxFileClient.js +100 -25
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +3 -1
- package/dist/clients/ConceptDescriptionRepositoryClient.js +93 -29
- package/dist/clients/SubmodelRegistryClient.d.ts +3 -1
- package/dist/clients/SubmodelRegistryClient.js +91 -21
- package/dist/clients/SubmodelRepositoryClient.d.ts +229 -22
- package/dist/clients/SubmodelRepositoryClient.js +689 -201
- package/dist/generated/AasDiscoveryService/models/index.d.ts +2 -2
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +1 -1
- package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +1 -1
- package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +1 -1
- package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +1 -1
- package/dist/generated/AasRegistryService/index.d.ts +1 -1
- package/dist/generated/AasRegistryService/index.js +1 -1
- package/dist/generated/AasRegistryService/models/index.d.ts +3 -3
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +3 -3
- package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1 -1
- package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +1 -1
- package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +1 -1
- package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +1 -1
- package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +1 -1
- package/dist/generated/AasRepositoryService/index.d.ts +1 -1
- package/dist/generated/AasRepositoryService/index.js +1 -1
- package/dist/generated/AasRepositoryService/models/index.d.ts +7 -7
- package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +5 -3
- package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +6 -0
- package/dist/generated/AasxFileService/apis/DescriptionAPIApi.d.ts +26 -0
- package/dist/generated/AasxFileService/apis/DescriptionAPIApi.js +40 -0
- package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
- package/dist/generated/AasxFileService/apis/index.js +1 -0
- package/dist/generated/AasxFileService/models/index.d.ts +45 -0
- package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2 -2
- package/dist/generated/SubmodelRegistryService/models/index.d.ts +2 -2
- package/dist/generated/SubmodelRepositoryService/models/index.d.ts +9 -9
- package/dist/generated/runtime.js +7 -0
- package/dist/lib/errorHandler.js +13 -2
- package/dist/models/api.d.ts +4 -2
- package/dist/services/AasService.d.ts +21 -1
- package/dist/services/AasService.js +114 -26
- package/dist/services/SubmodelService.d.ts +21 -1
- package/dist/services/SubmodelService.js +119 -21
- package/package.json +14 -3
- package/dist/generated/AasRegistryService/runtime.d.ts +0 -181
- package/dist/generated/AasRegistryService/runtime.js +0 -326
- package/dist/generated/AasRepositoryService/runtime.d.ts +0 -181
- package/dist/generated/AasRepositoryService/runtime.js +0 -326
|
@@ -2,19 +2,26 @@ import type { ApiResult } from '../models/api';
|
|
|
2
2
|
import { AasxFileService } from '../generated';
|
|
3
3
|
import { Configuration } from '../generated/runtime';
|
|
4
4
|
export declare class AasxFileClient {
|
|
5
|
+
private static requireIdentifier;
|
|
6
|
+
private static extractStatusCode;
|
|
5
7
|
/**
|
|
6
8
|
* Returns a list of available AASX packages at the server
|
|
7
9
|
*
|
|
8
10
|
* @param options Object containing:
|
|
9
11
|
* - configuration: The http request options
|
|
10
12
|
* - aasId?: The Asset Administration Shell’s unique id
|
|
13
|
+
* - limit?: The maximum number of elements in the response array
|
|
14
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
11
15
|
*
|
|
12
16
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
13
17
|
*/
|
|
14
18
|
getAllAASXPackageIds(options: {
|
|
15
19
|
configuration: Configuration;
|
|
16
20
|
aasId?: string;
|
|
21
|
+
limit?: number;
|
|
22
|
+
cursor?: string;
|
|
17
23
|
}): Promise<ApiResult<{
|
|
24
|
+
pagedResult: AasxFileService.PagedResultPagingMetadata | undefined;
|
|
18
25
|
result: AasxFileService.PackageDescription[];
|
|
19
26
|
}, AasxFileService.Result>>;
|
|
20
27
|
/**
|
|
@@ -79,4 +86,15 @@ export declare class AasxFileClient {
|
|
|
79
86
|
configuration: Configuration;
|
|
80
87
|
packageId: string;
|
|
81
88
|
}): Promise<ApiResult<void, AasxFileService.Result>>;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the self-describing information of a network resource (ServiceDescription)
|
|
91
|
+
*
|
|
92
|
+
* @param options Object containing:
|
|
93
|
+
* - configuration: The http request options
|
|
94
|
+
*
|
|
95
|
+
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
96
|
+
*/
|
|
97
|
+
getSelfDescription(options: {
|
|
98
|
+
configuration: Configuration;
|
|
99
|
+
}): Promise<ApiResult<AasxFileService.ServiceDescription, AasxFileService.Result>>;
|
|
82
100
|
}
|
|
@@ -1,33 +1,67 @@
|
|
|
1
1
|
import { AasxFileService } from '../generated';
|
|
2
|
+
import { RequiredError } from '../generated/runtime';
|
|
2
3
|
import { applyDefaults } from '../lib/apiConfig';
|
|
3
4
|
import { base64Encode } from '../lib/base64Url';
|
|
4
5
|
import { handleApiError } from '../lib/errorHandler';
|
|
5
6
|
export class AasxFileClient {
|
|
7
|
+
static requireIdentifier(value, field) {
|
|
8
|
+
if (value === null || value === undefined || value.trim() === '') {
|
|
9
|
+
throw new RequiredError(field, `Required parameter "${field}" was null, undefined, or empty.`);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
static extractStatusCode(err, parsedError) {
|
|
14
|
+
const responseStatus = err?.response?.status;
|
|
15
|
+
if (typeof responseStatus === 'number') {
|
|
16
|
+
return responseStatus;
|
|
17
|
+
}
|
|
18
|
+
if (err instanceof RequiredError || err?.name === 'RequiredError') {
|
|
19
|
+
return 400;
|
|
20
|
+
}
|
|
21
|
+
const code = parsedError?.messages?.[0]?.code;
|
|
22
|
+
if (!code) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const parsedCode = Number.parseInt(code, 10);
|
|
26
|
+
return Number.isNaN(parsedCode) ? undefined : parsedCode;
|
|
27
|
+
}
|
|
6
28
|
/**
|
|
7
29
|
* Returns a list of available AASX packages at the server
|
|
8
30
|
*
|
|
9
31
|
* @param options Object containing:
|
|
10
32
|
* - configuration: The http request options
|
|
11
33
|
* - aasId?: The Asset Administration Shell’s unique id
|
|
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
|
|
12
36
|
*
|
|
13
37
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
14
38
|
*/
|
|
15
39
|
async getAllAASXPackageIds(options) {
|
|
16
|
-
const { configuration, aasId } = options;
|
|
40
|
+
const { configuration, aasId, limit, cursor } = options;
|
|
17
41
|
try {
|
|
18
42
|
const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
aasId:
|
|
43
|
+
const encodedAasIdentifier = aasId ? base64Encode(aasId) : undefined;
|
|
44
|
+
const response = await apiInstance.getAllAASXPackageIdsRaw({
|
|
45
|
+
aasId: encodedAasIdentifier,
|
|
46
|
+
limit: limit,
|
|
47
|
+
cursor: cursor,
|
|
22
48
|
});
|
|
49
|
+
const payload = await response.value();
|
|
50
|
+
const result = payload.result ?? [];
|
|
51
|
+
const pagedResult = payload.paging_metadata;
|
|
23
52
|
return {
|
|
24
53
|
success: true,
|
|
25
|
-
data: { result },
|
|
54
|
+
data: { pagedResult, result },
|
|
55
|
+
statusCode: response.raw.status,
|
|
26
56
|
};
|
|
27
57
|
}
|
|
28
58
|
catch (err) {
|
|
29
59
|
const customError = await handleApiError(err);
|
|
30
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
error: customError,
|
|
63
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
64
|
+
};
|
|
31
65
|
}
|
|
32
66
|
}
|
|
33
67
|
/**
|
|
@@ -45,18 +79,21 @@ export class AasxFileClient {
|
|
|
45
79
|
const { configuration, aasIds, file, fileName } = options;
|
|
46
80
|
try {
|
|
47
81
|
const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
|
|
48
|
-
|
|
49
|
-
//const encodedFileName = base64Encode(fileName);
|
|
50
|
-
const result = await apiInstance.postAASXPackage({
|
|
82
|
+
const response = await apiInstance.postAASXPackageRaw({
|
|
51
83
|
aasIds: aasIds,
|
|
52
84
|
file: file,
|
|
53
85
|
fileName: fileName,
|
|
54
86
|
});
|
|
55
|
-
|
|
87
|
+
const result = await response.value();
|
|
88
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
56
89
|
}
|
|
57
90
|
catch (err) {
|
|
58
91
|
const customError = await handleApiError(err);
|
|
59
|
-
return {
|
|
92
|
+
return {
|
|
93
|
+
success: false,
|
|
94
|
+
error: customError,
|
|
95
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
96
|
+
};
|
|
60
97
|
}
|
|
61
98
|
}
|
|
62
99
|
/**
|
|
@@ -72,15 +109,20 @@ export class AasxFileClient {
|
|
|
72
109
|
const { configuration, packageId } = options;
|
|
73
110
|
try {
|
|
74
111
|
const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
|
|
75
|
-
const encodedPackageId = base64Encode(packageId);
|
|
76
|
-
const
|
|
112
|
+
const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
|
|
113
|
+
const response = await apiInstance.getAASXByPackageIdRaw({
|
|
77
114
|
packageId: encodedPackageId,
|
|
78
115
|
});
|
|
79
|
-
|
|
116
|
+
const result = await response.value();
|
|
117
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
80
118
|
}
|
|
81
119
|
catch (err) {
|
|
82
120
|
const customError = await handleApiError(err);
|
|
83
|
-
return {
|
|
121
|
+
return {
|
|
122
|
+
success: false,
|
|
123
|
+
error: customError,
|
|
124
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
125
|
+
};
|
|
84
126
|
}
|
|
85
127
|
}
|
|
86
128
|
/**
|
|
@@ -99,20 +141,23 @@ export class AasxFileClient {
|
|
|
99
141
|
const { configuration, packageId, aasIds, file, fileName } = options;
|
|
100
142
|
try {
|
|
101
143
|
const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
//const encodedFileName = base64Encode(fileName);
|
|
105
|
-
const result = await apiInstance.putAASXByPackageId({
|
|
144
|
+
const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
|
|
145
|
+
const response = await apiInstance.putAASXByPackageIdRaw({
|
|
106
146
|
packageId: encodedPackageId,
|
|
107
147
|
aasIds: aasIds,
|
|
108
148
|
file: file,
|
|
109
149
|
fileName: fileName,
|
|
110
150
|
});
|
|
111
|
-
|
|
151
|
+
const result = await response.value();
|
|
152
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
112
153
|
}
|
|
113
154
|
catch (err) {
|
|
114
155
|
const customError = await handleApiError(err);
|
|
115
|
-
return {
|
|
156
|
+
return {
|
|
157
|
+
success: false,
|
|
158
|
+
error: customError,
|
|
159
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
160
|
+
};
|
|
116
161
|
}
|
|
117
162
|
}
|
|
118
163
|
/**
|
|
@@ -128,15 +173,45 @@ export class AasxFileClient {
|
|
|
128
173
|
const { configuration, packageId } = options;
|
|
129
174
|
try {
|
|
130
175
|
const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
|
|
131
|
-
const encodedPackageId = base64Encode(packageId);
|
|
132
|
-
const
|
|
176
|
+
const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
|
|
177
|
+
const response = await apiInstance.deleteAASXByPackageIdRaw({
|
|
133
178
|
packageId: encodedPackageId,
|
|
134
179
|
});
|
|
135
|
-
|
|
180
|
+
const result = await response.value();
|
|
181
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
136
182
|
}
|
|
137
183
|
catch (err) {
|
|
138
184
|
const customError = await handleApiError(err);
|
|
139
|
-
return {
|
|
185
|
+
return {
|
|
186
|
+
success: false,
|
|
187
|
+
error: customError,
|
|
188
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Returns the self-describing information of a network resource (ServiceDescription)
|
|
194
|
+
*
|
|
195
|
+
* @param options Object containing:
|
|
196
|
+
* - configuration: The http request options
|
|
197
|
+
*
|
|
198
|
+
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
199
|
+
*/
|
|
200
|
+
async getSelfDescription(options) {
|
|
201
|
+
const { configuration } = options;
|
|
202
|
+
try {
|
|
203
|
+
const apiInstance = new AasxFileService.DescriptionAPIApi(applyDefaults(configuration));
|
|
204
|
+
const response = await apiInstance.getSelfDescriptionRaw();
|
|
205
|
+
const result = await response.value();
|
|
206
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
const customError = await handleApiError(err);
|
|
210
|
+
return {
|
|
211
|
+
success: false,
|
|
212
|
+
error: customError,
|
|
213
|
+
statusCode: AasxFileClient.extractStatusCode(err, customError),
|
|
214
|
+
};
|
|
140
215
|
}
|
|
141
216
|
}
|
|
142
217
|
}
|
|
@@ -3,6 +3,8 @@ import type { ApiResult } from '../models/api';
|
|
|
3
3
|
import { ConceptDescriptionRepositoryService } from '../generated';
|
|
4
4
|
import { Configuration } from '../generated/runtime';
|
|
5
5
|
export declare class ConceptDescriptionRepositoryClient {
|
|
6
|
+
private static requireIdentifier;
|
|
7
|
+
private static extractStatusCode;
|
|
6
8
|
/**
|
|
7
9
|
* Returns a specific Concept Description
|
|
8
10
|
*
|
|
@@ -53,7 +55,7 @@ export declare class ConceptDescriptionRepositoryClient {
|
|
|
53
55
|
* - isCaseOf?: IsCaseOf reference (UTF8-BASE64-URL-encoded)
|
|
54
56
|
* - dataSpecificationRef?: DataSpecification reference (UTF8-BASE64-URL-encoded)
|
|
55
57
|
* - limit?: The maximum number of elements in the response array
|
|
56
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
58
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
57
59
|
*
|
|
58
60
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
59
61
|
*/
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { ConceptDescriptionRepositoryService } from '../generated'; // Updated import
|
|
2
|
+
import { RequiredError } from '../generated/runtime';
|
|
2
3
|
import { applyDefaults } from '../lib/apiConfig';
|
|
3
4
|
import { base64Encode } from '../lib/base64Url';
|
|
4
5
|
import { convertApiCDToCoreCD, convertCoreCDToApiCD } from '../lib/convertConceptDescriptionTypes';
|
|
5
6
|
import { handleApiError } from '../lib/errorHandler';
|
|
6
7
|
export class ConceptDescriptionRepositoryClient {
|
|
8
|
+
static requireIdentifier(value, field) {
|
|
9
|
+
if (value === null || value === undefined || value.trim() === '') {
|
|
10
|
+
throw new RequiredError(field, `Required parameter "${field}" was null, undefined, or empty.`);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
static extractStatusCode(err, parsedError) {
|
|
15
|
+
const responseStatus = err?.response?.status;
|
|
16
|
+
if (typeof responseStatus === 'number') {
|
|
17
|
+
return responseStatus;
|
|
18
|
+
}
|
|
19
|
+
if (err instanceof RequiredError || err?.name === 'RequiredError') {
|
|
20
|
+
return 400;
|
|
21
|
+
}
|
|
22
|
+
const code = parsedError?.messages?.[0]?.code;
|
|
23
|
+
if (!code) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const parsedCode = Number.parseInt(code, 10);
|
|
27
|
+
return Number.isNaN(parsedCode) ? undefined : parsedCode;
|
|
28
|
+
}
|
|
7
29
|
/**
|
|
8
30
|
* Returns a specific Concept Description
|
|
9
31
|
*
|
|
@@ -17,15 +39,20 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
17
39
|
const { configuration, cdIdentifier } = options;
|
|
18
40
|
try {
|
|
19
41
|
const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
|
|
20
|
-
const encodedCdIdentifier = base64Encode(cdIdentifier);
|
|
21
|
-
const
|
|
42
|
+
const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
|
|
43
|
+
const response = await apiInstance.getConceptDescriptionByIdRaw({
|
|
22
44
|
cdIdentifier: encodedCdIdentifier,
|
|
23
45
|
});
|
|
24
|
-
|
|
46
|
+
const result = await response.value();
|
|
47
|
+
return { success: true, data: convertApiCDToCoreCD(result), statusCode: response.raw.status };
|
|
25
48
|
}
|
|
26
49
|
catch (err) {
|
|
27
50
|
const customError = await handleApiError(err);
|
|
28
|
-
return {
|
|
51
|
+
return {
|
|
52
|
+
success: false,
|
|
53
|
+
error: customError,
|
|
54
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
55
|
+
};
|
|
29
56
|
}
|
|
30
57
|
}
|
|
31
58
|
/**
|
|
@@ -41,15 +68,20 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
41
68
|
const { configuration, cdIdentifier } = options;
|
|
42
69
|
try {
|
|
43
70
|
const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
|
|
44
|
-
const encodedCdIdentifier = base64Encode(cdIdentifier);
|
|
45
|
-
const
|
|
71
|
+
const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
|
|
72
|
+
const response = await apiInstance.deleteConceptDescriptionByIdRaw({
|
|
46
73
|
cdIdentifier: encodedCdIdentifier,
|
|
47
74
|
});
|
|
48
|
-
|
|
75
|
+
const result = await response.value();
|
|
76
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
49
77
|
}
|
|
50
78
|
catch (err) {
|
|
51
79
|
const customError = await handleApiError(err);
|
|
52
|
-
return {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: customError,
|
|
83
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
84
|
+
};
|
|
53
85
|
}
|
|
54
86
|
}
|
|
55
87
|
/**
|
|
@@ -66,16 +98,28 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
66
98
|
const { configuration, cdIdentifier, conceptDescription } = options;
|
|
67
99
|
try {
|
|
68
100
|
const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
|
|
69
|
-
const encodedCdIdentifier = base64Encode(cdIdentifier);
|
|
70
|
-
const
|
|
101
|
+
const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
|
|
102
|
+
const response = await apiInstance.putConceptDescriptionByIdRaw({
|
|
71
103
|
cdIdentifier: encodedCdIdentifier,
|
|
72
104
|
conceptDescription: convertCoreCDToApiCD(conceptDescription),
|
|
73
105
|
});
|
|
74
|
-
|
|
106
|
+
if (response.raw.status === 204) {
|
|
107
|
+
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
108
|
+
}
|
|
109
|
+
const result = await response.value();
|
|
110
|
+
return {
|
|
111
|
+
success: true,
|
|
112
|
+
data: result ? convertApiCDToCoreCD(result) : undefined,
|
|
113
|
+
statusCode: response.raw.status,
|
|
114
|
+
};
|
|
75
115
|
}
|
|
76
116
|
catch (err) {
|
|
77
117
|
const customError = await handleApiError(err);
|
|
78
|
-
return {
|
|
118
|
+
return {
|
|
119
|
+
success: false,
|
|
120
|
+
error: customError,
|
|
121
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
122
|
+
};
|
|
79
123
|
}
|
|
80
124
|
}
|
|
81
125
|
/**
|
|
@@ -87,7 +131,7 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
87
131
|
* - isCaseOf?: IsCaseOf reference (UTF8-BASE64-URL-encoded)
|
|
88
132
|
* - dataSpecificationRef?: DataSpecification reference (UTF8-BASE64-URL-encoded)
|
|
89
133
|
* - limit?: The maximum number of elements in the response array
|
|
90
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
134
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
91
135
|
*
|
|
92
136
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
93
137
|
*/
|
|
@@ -95,26 +139,31 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
95
139
|
const { configuration, idShort, isCaseOf, dataSpecificationRef, limit, cursor } = options;
|
|
96
140
|
try {
|
|
97
141
|
const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
|
|
98
|
-
const encodedIsCaseOf = isCaseOf ? base64Encode(
|
|
99
|
-
const encodedDataSpecificationRef = dataSpecificationRef
|
|
100
|
-
|
|
101
|
-
: undefined;
|
|
102
|
-
const result = await apiInstance.getAllConceptDescriptions({
|
|
142
|
+
const encodedIsCaseOf = isCaseOf ? base64Encode(isCaseOf) : undefined;
|
|
143
|
+
const encodedDataSpecificationRef = dataSpecificationRef ? base64Encode(dataSpecificationRef) : undefined;
|
|
144
|
+
const response = await apiInstance.getAllConceptDescriptionsRaw({
|
|
103
145
|
idShort: idShort,
|
|
104
146
|
isCaseOf: encodedIsCaseOf,
|
|
105
147
|
dataSpecificationRef: encodedDataSpecificationRef,
|
|
106
148
|
limit: limit,
|
|
107
149
|
cursor: cursor,
|
|
108
150
|
});
|
|
151
|
+
const result = await response.value();
|
|
109
152
|
const conceptDescriptions = (result.result ?? []).map(convertApiCDToCoreCD);
|
|
153
|
+
const pagedResult = result.paging_metadata;
|
|
110
154
|
return {
|
|
111
155
|
success: true,
|
|
112
|
-
data: { pagedResult
|
|
156
|
+
data: { pagedResult, result: conceptDescriptions },
|
|
157
|
+
statusCode: response.raw.status,
|
|
113
158
|
};
|
|
114
159
|
}
|
|
115
160
|
catch (err) {
|
|
116
161
|
const customError = await handleApiError(err);
|
|
117
|
-
return {
|
|
162
|
+
return {
|
|
163
|
+
success: false,
|
|
164
|
+
error: customError,
|
|
165
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
166
|
+
};
|
|
118
167
|
}
|
|
119
168
|
}
|
|
120
169
|
/**
|
|
@@ -130,14 +179,19 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
130
179
|
const { configuration, conceptDescription } = options;
|
|
131
180
|
try {
|
|
132
181
|
const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
|
|
133
|
-
const
|
|
182
|
+
const response = await apiInstance.postConceptDescriptionRaw({
|
|
134
183
|
conceptDescription: convertCoreCDToApiCD(conceptDescription),
|
|
135
184
|
});
|
|
136
|
-
|
|
185
|
+
const result = await response.value();
|
|
186
|
+
return { success: true, data: convertApiCDToCoreCD(result), statusCode: response.raw.status };
|
|
137
187
|
}
|
|
138
188
|
catch (err) {
|
|
139
189
|
const customError = await handleApiError(err);
|
|
140
|
-
return {
|
|
190
|
+
return {
|
|
191
|
+
success: false,
|
|
192
|
+
error: customError,
|
|
193
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
194
|
+
};
|
|
141
195
|
}
|
|
142
196
|
}
|
|
143
197
|
/**
|
|
@@ -155,16 +209,21 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
155
209
|
const { configuration, aasIds, submodelIds, includeConceptDescriptions } = options;
|
|
156
210
|
try {
|
|
157
211
|
const apiInstance = new ConceptDescriptionRepositoryService.SerializationAPIApi(applyDefaults(configuration));
|
|
158
|
-
const
|
|
212
|
+
const response = await apiInstance.generateSerializationByIdsRaw({
|
|
159
213
|
aasIds: aasIds,
|
|
160
214
|
submodelIds: submodelIds,
|
|
161
215
|
includeConceptDescriptions: includeConceptDescriptions,
|
|
162
216
|
});
|
|
163
|
-
|
|
217
|
+
const result = await response.value();
|
|
218
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
164
219
|
}
|
|
165
220
|
catch (err) {
|
|
166
221
|
const customError = await handleApiError(err);
|
|
167
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
success: false,
|
|
224
|
+
error: customError,
|
|
225
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
226
|
+
};
|
|
168
227
|
}
|
|
169
228
|
}
|
|
170
229
|
/**
|
|
@@ -179,12 +238,17 @@ export class ConceptDescriptionRepositoryClient {
|
|
|
179
238
|
const { configuration } = options;
|
|
180
239
|
try {
|
|
181
240
|
const apiInstance = new ConceptDescriptionRepositoryService.DescriptionAPIApi(applyDefaults(configuration));
|
|
182
|
-
const
|
|
183
|
-
|
|
241
|
+
const response = await apiInstance.getSelfDescriptionRaw();
|
|
242
|
+
const result = await response.value();
|
|
243
|
+
return { success: true, data: result, statusCode: response.raw.status };
|
|
184
244
|
}
|
|
185
245
|
catch (err) {
|
|
186
246
|
const customError = await handleApiError(err);
|
|
187
|
-
return {
|
|
247
|
+
return {
|
|
248
|
+
success: false,
|
|
249
|
+
error: customError,
|
|
250
|
+
statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
|
|
251
|
+
};
|
|
188
252
|
}
|
|
189
253
|
}
|
|
190
254
|
}
|
|
@@ -3,13 +3,15 @@ import { SubmodelRegistryService } from '../generated';
|
|
|
3
3
|
import { Configuration } from '../generated/runtime';
|
|
4
4
|
import { SubmodelDescriptor } from '../models/Descriptors';
|
|
5
5
|
export declare class SubmodelRegistryClient {
|
|
6
|
+
private static requireIdentifier;
|
|
7
|
+
private static extractStatusCode;
|
|
6
8
|
/**
|
|
7
9
|
* Returns all Submodel Descriptors
|
|
8
10
|
*
|
|
9
11
|
* @param options Object containing:
|
|
10
12
|
* - configuration: The http request options
|
|
11
13
|
* - limit?: The maximum number of elements in the response array
|
|
12
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
14
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
13
15
|
*
|
|
14
16
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
15
17
|
*/
|