basyx-typescript-sdk 2.2.4 → 2.3.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.
- package/README.md +169 -0
- package/bundle/index.cjs +3484 -2149
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +3484 -2149
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasDiscoveryClient.d.ts +12 -5
- package/dist/clients/AasDiscoveryClient.js +104 -27
- package/dist/clients/AasRegistryClient.d.ts +32 -10
- package/dist/clients/AasRegistryClient.js +211 -61
- package/dist/clients/AasRepositoryClient.d.ts +231 -60
- package/dist/clients/AasRepositoryClient.js +1021 -353
- package/dist/clients/AasxFileClient.d.ts +29 -3
- package/dist/clients/AasxFileClient.js +122 -31
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +14 -4
- package/dist/clients/ConceptDescriptionRepositoryClient.js +127 -35
- package/dist/clients/SubmodelRegistryClient.d.ts +14 -4
- package/dist/clients/SubmodelRegistryClient.js +117 -27
- package/dist/clients/SubmodelRepositoryClient.d.ts +339 -58
- package/dist/clients/SubmodelRepositoryClient.js +913 -269
- 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/apiConfig.d.ts +2 -1
- package/dist/lib/apiConfig.js +27 -2
- package/dist/lib/conditionalRequests.d.ts +28 -0
- package/dist/lib/conditionalRequests.js +55 -0
- package/dist/lib/errorHandler.js +13 -2
- package/dist/models/api.d.ts +40 -2
- package/dist/services/AasService.d.ts +34 -4
- package/dist/services/AasService.js +159 -33
- package/dist/services/SubmodelService.d.ts +34 -4
- package/dist/services/SubmodelService.js +168 -28
- 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
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { SpecificAssetId } from '@aas-core-works/aas-core3.1-typescript/types';
|
|
2
|
-
import type { ApiResult } from '../models/api';
|
|
2
|
+
import type { ApiResult, ConditionalApiResult } from '../models/api';
|
|
3
3
|
import type { AssetId } from '../models/AssetId';
|
|
4
4
|
import { AasDiscoveryService } from '../generated';
|
|
5
5
|
import { Configuration } from '../generated/runtime';
|
|
6
6
|
export declare class AasDiscoveryClient {
|
|
7
|
+
private static extractStatusCode;
|
|
7
8
|
/**
|
|
8
9
|
* Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
|
|
9
10
|
*
|
|
@@ -11,7 +12,7 @@ export declare class AasDiscoveryClient {
|
|
|
11
12
|
* - configuration: The http request options
|
|
12
13
|
* - assetIds?: A list of specific Asset identifiers
|
|
13
14
|
* - limit?: The maximum number of elements in the response array
|
|
14
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
15
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
15
16
|
*
|
|
16
17
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
17
18
|
*/
|
|
@@ -31,6 +32,7 @@ export declare class AasDiscoveryClient {
|
|
|
31
32
|
* - configuration: The http request options.
|
|
32
33
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
33
34
|
* - specificAssetId: A set of specific asset identifiers
|
|
35
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
34
36
|
*
|
|
35
37
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
36
38
|
*/
|
|
@@ -38,6 +40,7 @@ export declare class AasDiscoveryClient {
|
|
|
38
40
|
configuration: Configuration;
|
|
39
41
|
aasIdentifier: string;
|
|
40
42
|
specificAssetId: Array<SpecificAssetId>;
|
|
43
|
+
ifMatch?: string;
|
|
41
44
|
}): Promise<ApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result>>;
|
|
42
45
|
/**
|
|
43
46
|
* Deletes specified specific asset identifiers linked to an Asset Administration Shell
|
|
@@ -45,12 +48,14 @@ export declare class AasDiscoveryClient {
|
|
|
45
48
|
* @param options Object containing:
|
|
46
49
|
* - configuration: The http request options
|
|
47
50
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
51
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
48
52
|
*
|
|
49
53
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
50
54
|
*/
|
|
51
55
|
deleteAllAssetLinksById(options: {
|
|
52
56
|
configuration: Configuration;
|
|
53
57
|
aasIdentifier: string;
|
|
58
|
+
ifMatch?: string;
|
|
54
59
|
}): Promise<ApiResult<void, AasDiscoveryService.Result>>;
|
|
55
60
|
/**
|
|
56
61
|
* Returns a list of specific asset identifiers based on an Asset Administration Shell ID to edit discoverable content.
|
|
@@ -58,13 +63,15 @@ export declare class AasDiscoveryClient {
|
|
|
58
63
|
* @param options Object containing:
|
|
59
64
|
* - configuration: The http request options
|
|
60
65
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
66
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
61
67
|
*
|
|
62
68
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
63
69
|
*/
|
|
64
|
-
getAllAssetLinksById(options: {
|
|
70
|
+
getAllAssetLinksById<IfNoneMatch extends string | undefined = undefined>(options: {
|
|
65
71
|
configuration: Configuration;
|
|
66
72
|
aasIdentifier: string;
|
|
67
|
-
|
|
73
|
+
ifNoneMatch?: IfNoneMatch;
|
|
74
|
+
}): Promise<ConditionalApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result, IfNoneMatch>>;
|
|
68
75
|
/**
|
|
69
76
|
* Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
|
|
70
77
|
*
|
|
@@ -72,7 +79,7 @@ export declare class AasDiscoveryClient {
|
|
|
72
79
|
* - configuration: The http request options
|
|
73
80
|
* - assetLink?: A list of specific Asset identifiers
|
|
74
81
|
* - limit?: The maximum number of elements in the response array
|
|
75
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
82
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
76
83
|
*
|
|
77
84
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
78
85
|
*/
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { AasDiscoveryService } from '../generated';
|
|
2
|
+
import { RequiredError } from '../generated/runtime';
|
|
2
3
|
import { applyDefaults } from '../lib/apiConfig';
|
|
3
4
|
import { base64Encode } from '../lib/base64Url';
|
|
5
|
+
import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
|
|
4
6
|
import { convertApiAssetIdToCoreAssetId, convertCoreAssetIdToApiAssetId } from '../lib/convertAasDiscoveryTypes';
|
|
5
7
|
import { handleApiError } from '../lib/errorHandler';
|
|
6
8
|
export class AasDiscoveryClient {
|
|
9
|
+
static extractStatusCode(err, parsedError) {
|
|
10
|
+
const responseStatus = err?.response?.status;
|
|
11
|
+
if (typeof responseStatus === 'number') {
|
|
12
|
+
return responseStatus;
|
|
13
|
+
}
|
|
14
|
+
if (err instanceof RequiredError || err?.name === 'RequiredError') {
|
|
15
|
+
return 400;
|
|
16
|
+
}
|
|
17
|
+
const code = parsedError?.messages?.[0]?.code;
|
|
18
|
+
if (!code) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const parsedCode = Number.parseInt(code, 10);
|
|
22
|
+
return Number.isNaN(parsedCode) ? undefined : parsedCode;
|
|
23
|
+
}
|
|
7
24
|
/**
|
|
8
25
|
* Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
|
|
9
26
|
*
|
|
@@ -11,7 +28,7 @@ export class AasDiscoveryClient {
|
|
|
11
28
|
* - configuration: The http request options
|
|
12
29
|
* - assetIds?: A list of specific Asset identifiers
|
|
13
30
|
* - limit?: The maximum number of elements in the response array
|
|
14
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
31
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
15
32
|
*
|
|
16
33
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
17
34
|
*/
|
|
@@ -19,21 +36,31 @@ export class AasDiscoveryClient {
|
|
|
19
36
|
const { configuration, assetIds, limit, cursor } = options;
|
|
20
37
|
try {
|
|
21
38
|
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
|
|
22
|
-
|
|
23
|
-
const
|
|
39
|
+
// Only name and value: objects such as core SpecificAssetIds carry further fields that may be null
|
|
40
|
+
const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify({ name: id.name, value: id.value })));
|
|
41
|
+
const response = await apiInstance.getAllAssetAdministrationShellIdsByAssetLinkRaw({
|
|
24
42
|
assetIds: encodedAssetIds,
|
|
25
43
|
limit: limit,
|
|
26
44
|
cursor: cursor,
|
|
27
45
|
});
|
|
46
|
+
const result = await response.value();
|
|
28
47
|
const shellIds = result.result ?? [];
|
|
48
|
+
const pagedResult = result.paging_metadata;
|
|
29
49
|
return {
|
|
30
50
|
success: true,
|
|
31
|
-
data: { pagedResult
|
|
51
|
+
data: { pagedResult, result: shellIds },
|
|
52
|
+
statusCode: response.raw.status,
|
|
53
|
+
etag: getEtag(response.raw),
|
|
32
54
|
};
|
|
33
55
|
}
|
|
34
56
|
catch (err) {
|
|
35
57
|
const customError = await handleApiError(err);
|
|
36
|
-
return {
|
|
58
|
+
return {
|
|
59
|
+
success: false,
|
|
60
|
+
error: customError,
|
|
61
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
62
|
+
...getConditionalErrorFields(err),
|
|
63
|
+
};
|
|
37
64
|
}
|
|
38
65
|
}
|
|
39
66
|
/**
|
|
@@ -43,23 +70,35 @@ export class AasDiscoveryClient {
|
|
|
43
70
|
* - configuration: The http request options.
|
|
44
71
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
45
72
|
* - specificAssetId: A set of specific asset identifiers
|
|
73
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
46
74
|
*
|
|
47
75
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
48
76
|
*/
|
|
49
77
|
async postAllAssetLinksById(options) {
|
|
50
|
-
const { configuration, aasIdentifier, specificAssetId } = options;
|
|
78
|
+
const { configuration, aasIdentifier, specificAssetId, ifMatch } = options;
|
|
51
79
|
try {
|
|
52
|
-
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
|
|
80
|
+
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
53
81
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
54
|
-
const
|
|
82
|
+
const response = await apiInstance.postAllAssetLinksByIdRaw({
|
|
55
83
|
aasIdentifier: encodedAasIdentifier,
|
|
56
84
|
specificAssetId: specificAssetId.map(convertCoreAssetIdToApiAssetId),
|
|
57
85
|
});
|
|
58
|
-
|
|
86
|
+
const result = await response.value();
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
data: result.map(convertApiAssetIdToCoreAssetId),
|
|
90
|
+
statusCode: response.raw.status,
|
|
91
|
+
etag: getEtag(response.raw),
|
|
92
|
+
};
|
|
59
93
|
}
|
|
60
94
|
catch (err) {
|
|
61
95
|
const customError = await handleApiError(err);
|
|
62
|
-
return {
|
|
96
|
+
return {
|
|
97
|
+
success: false,
|
|
98
|
+
error: customError,
|
|
99
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
100
|
+
...getConditionalErrorFields(err),
|
|
101
|
+
};
|
|
63
102
|
}
|
|
64
103
|
}
|
|
65
104
|
/**
|
|
@@ -68,22 +107,29 @@ export class AasDiscoveryClient {
|
|
|
68
107
|
* @param options Object containing:
|
|
69
108
|
* - configuration: The http request options
|
|
70
109
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
110
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
71
111
|
*
|
|
72
112
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
73
113
|
*/
|
|
74
114
|
async deleteAllAssetLinksById(options) {
|
|
75
|
-
const { configuration, aasIdentifier } = options;
|
|
115
|
+
const { configuration, aasIdentifier, ifMatch } = options;
|
|
76
116
|
try {
|
|
77
|
-
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
|
|
117
|
+
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
78
118
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
79
|
-
const
|
|
119
|
+
const response = await apiInstance.deleteAllAssetLinksByIdRaw({
|
|
80
120
|
aasIdentifier: encodedAasIdentifier,
|
|
81
121
|
});
|
|
82
|
-
|
|
122
|
+
const result = await response.value();
|
|
123
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
83
124
|
}
|
|
84
125
|
catch (err) {
|
|
85
126
|
const customError = await handleApiError(err);
|
|
86
|
-
return {
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
error: customError,
|
|
130
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
131
|
+
...getConditionalErrorFields(err),
|
|
132
|
+
};
|
|
87
133
|
}
|
|
88
134
|
}
|
|
89
135
|
/**
|
|
@@ -92,22 +138,38 @@ export class AasDiscoveryClient {
|
|
|
92
138
|
* @param options Object containing:
|
|
93
139
|
* - configuration: The http request options
|
|
94
140
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
141
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
95
142
|
*
|
|
96
143
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
97
144
|
*/
|
|
98
145
|
async getAllAssetLinksById(options) {
|
|
99
|
-
const { configuration, aasIdentifier } = options;
|
|
146
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
100
147
|
try {
|
|
101
|
-
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
|
|
148
|
+
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
102
149
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
103
|
-
const
|
|
150
|
+
const response = await apiInstance.getAllAssetLinksByIdRaw({
|
|
104
151
|
aasIdentifier: encodedAasIdentifier,
|
|
105
152
|
});
|
|
106
|
-
|
|
153
|
+
const result = await response.value();
|
|
154
|
+
return {
|
|
155
|
+
success: true,
|
|
156
|
+
data: result.map(convertApiAssetIdToCoreAssetId),
|
|
157
|
+
statusCode: response.raw.status,
|
|
158
|
+
etag: getEtag(response.raw),
|
|
159
|
+
};
|
|
107
160
|
}
|
|
108
161
|
catch (err) {
|
|
162
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
163
|
+
if (notModified) {
|
|
164
|
+
return notModified;
|
|
165
|
+
}
|
|
109
166
|
const customError = await handleApiError(err);
|
|
110
|
-
return {
|
|
167
|
+
return {
|
|
168
|
+
success: false,
|
|
169
|
+
error: customError,
|
|
170
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
171
|
+
...getConditionalErrorFields(err),
|
|
172
|
+
};
|
|
111
173
|
}
|
|
112
174
|
}
|
|
113
175
|
/**
|
|
@@ -117,7 +179,7 @@ export class AasDiscoveryClient {
|
|
|
117
179
|
* - configuration: The http request options
|
|
118
180
|
* - assetLink?: A list of specific Asset identifiers
|
|
119
181
|
* - limit?: The maximum number of elements in the response array
|
|
120
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
182
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
121
183
|
*
|
|
122
184
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
123
185
|
*/
|
|
@@ -125,20 +187,29 @@ export class AasDiscoveryClient {
|
|
|
125
187
|
const { configuration, assetLink, limit, cursor } = options;
|
|
126
188
|
try {
|
|
127
189
|
const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
|
|
128
|
-
const
|
|
190
|
+
const response = await apiInstance.searchAllAssetAdministrationShellIdsByAssetLinkRaw({
|
|
129
191
|
assetLink: assetLink?.map((id) => ({ name: id.name, value: id.value })),
|
|
130
192
|
limit: limit,
|
|
131
193
|
cursor: cursor,
|
|
132
194
|
});
|
|
195
|
+
const result = await response.value();
|
|
133
196
|
const shellIds = result.result ?? [];
|
|
197
|
+
const pagedResult = result.paging_metadata;
|
|
134
198
|
return {
|
|
135
199
|
success: true,
|
|
136
|
-
data: { pagedResult
|
|
200
|
+
data: { pagedResult, result: shellIds },
|
|
201
|
+
statusCode: response.raw.status,
|
|
202
|
+
etag: getEtag(response.raw),
|
|
137
203
|
};
|
|
138
204
|
}
|
|
139
205
|
catch (err) {
|
|
140
206
|
const customError = await handleApiError(err);
|
|
141
|
-
return {
|
|
207
|
+
return {
|
|
208
|
+
success: false,
|
|
209
|
+
error: customError,
|
|
210
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
211
|
+
...getConditionalErrorFields(err),
|
|
212
|
+
};
|
|
142
213
|
}
|
|
143
214
|
}
|
|
144
215
|
/**
|
|
@@ -153,12 +224,18 @@ export class AasDiscoveryClient {
|
|
|
153
224
|
const { configuration } = options;
|
|
154
225
|
try {
|
|
155
226
|
const apiInstance = new AasDiscoveryService.DescriptionAPIApi(applyDefaults(configuration));
|
|
156
|
-
const
|
|
157
|
-
|
|
227
|
+
const response = await apiInstance.getSelfDescriptionRaw();
|
|
228
|
+
const result = await response.value();
|
|
229
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
158
230
|
}
|
|
159
231
|
catch (err) {
|
|
160
232
|
const customError = await handleApiError(err);
|
|
161
|
-
return {
|
|
233
|
+
return {
|
|
234
|
+
success: false,
|
|
235
|
+
error: customError,
|
|
236
|
+
statusCode: AasDiscoveryClient.extractStatusCode(err, customError),
|
|
237
|
+
...getConditionalErrorFields(err),
|
|
238
|
+
};
|
|
162
239
|
}
|
|
163
240
|
}
|
|
164
241
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { ApiResult } from '../models/api';
|
|
1
|
+
import type { ApiResult, ConditionalApiResult } from '../models/api';
|
|
2
2
|
import { AasRegistryService } from '../generated';
|
|
3
3
|
import { Configuration } from '../generated/runtime';
|
|
4
4
|
import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
|
|
5
5
|
export declare class AasRegistryClient {
|
|
6
|
+
private static requireIdentifier;
|
|
7
|
+
private static extractStatusCode;
|
|
6
8
|
/**
|
|
7
9
|
* Returns all Asset Administration Shell 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
|
* - assetKind?: The Asset's kind (Instance or Type)
|
|
14
16
|
* - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
|
|
15
17
|
*
|
|
@@ -44,12 +46,14 @@ export declare class AasRegistryClient {
|
|
|
44
46
|
* @param options Object containing:
|
|
45
47
|
* - configuration: The http request options
|
|
46
48
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
49
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
47
50
|
*
|
|
48
51
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
49
52
|
*/
|
|
50
53
|
deleteAssetAdministrationShellDescriptorById(options: {
|
|
51
54
|
configuration: Configuration;
|
|
52
55
|
aasIdentifier: string;
|
|
56
|
+
ifMatch?: string;
|
|
53
57
|
}): Promise<ApiResult<void, AasRegistryService.Result>>;
|
|
54
58
|
/**
|
|
55
59
|
* Returns a specific Asset Administration Shell Descriptor
|
|
@@ -57,13 +61,15 @@ export declare class AasRegistryClient {
|
|
|
57
61
|
* @param options Object containing:
|
|
58
62
|
* - configuration: The http request options
|
|
59
63
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
64
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
60
65
|
*
|
|
61
66
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
62
67
|
*/
|
|
63
|
-
getAssetAdministrationShellDescriptorById(options: {
|
|
68
|
+
getAssetAdministrationShellDescriptorById<IfNoneMatch extends string | undefined = undefined>(options: {
|
|
64
69
|
configuration: Configuration;
|
|
65
70
|
aasIdentifier: string;
|
|
66
|
-
|
|
71
|
+
ifNoneMatch?: IfNoneMatch;
|
|
72
|
+
}): Promise<ConditionalApiResult<AssetAdministrationShellDescriptor, AasRegistryService.Result, IfNoneMatch>>;
|
|
67
73
|
/**
|
|
68
74
|
* Creates or updates an existing Asset Administration Shell Descriptor
|
|
69
75
|
*
|
|
@@ -71,6 +77,8 @@ export declare class AasRegistryClient {
|
|
|
71
77
|
* - configuration: The http request options
|
|
72
78
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
73
79
|
* - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
|
|
80
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
81
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
74
82
|
*
|
|
75
83
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
76
84
|
*/
|
|
@@ -78,6 +86,8 @@ export declare class AasRegistryClient {
|
|
|
78
86
|
configuration: Configuration;
|
|
79
87
|
aasIdentifier: string;
|
|
80
88
|
assetAdministrationShellDescriptor: AssetAdministrationShellDescriptor;
|
|
89
|
+
ifMatch?: string;
|
|
90
|
+
ifNoneMatch?: string;
|
|
81
91
|
}): Promise<ApiResult<AssetAdministrationShellDescriptor | void, AasRegistryService.Result>>;
|
|
82
92
|
/**
|
|
83
93
|
* Returns all Submodel Descriptors
|
|
@@ -86,19 +96,21 @@ export declare class AasRegistryClient {
|
|
|
86
96
|
* - configuration: The http request options
|
|
87
97
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
88
98
|
* - limit?: The maximum number of elements in the response array
|
|
89
|
-
* - cursor?: A server-generated identifier retrieved from
|
|
99
|
+
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
100
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
90
101
|
*
|
|
91
102
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
92
103
|
*/
|
|
93
|
-
getAllSubmodelDescriptorsThroughSuperpath(options: {
|
|
104
|
+
getAllSubmodelDescriptorsThroughSuperpath<IfNoneMatch extends string | undefined = undefined>(options: {
|
|
94
105
|
configuration: Configuration;
|
|
95
106
|
aasIdentifier: string;
|
|
96
107
|
limit?: number;
|
|
97
108
|
cursor?: string;
|
|
98
|
-
|
|
109
|
+
ifNoneMatch?: IfNoneMatch;
|
|
110
|
+
}): Promise<ConditionalApiResult<{
|
|
99
111
|
pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
|
|
100
112
|
result: SubmodelDescriptor[];
|
|
101
|
-
}, AasRegistryService.Result>>;
|
|
113
|
+
}, AasRegistryService.Result, IfNoneMatch>>;
|
|
102
114
|
/**
|
|
103
115
|
* Creates a new Submodel Descriptor, i.e. registers a submodel
|
|
104
116
|
*
|
|
@@ -106,6 +118,7 @@ export declare class AasRegistryClient {
|
|
|
106
118
|
* - configuration: The http request options.
|
|
107
119
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
108
120
|
* - submodelDescriptor: Submodel Descriptor object
|
|
121
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
109
122
|
*
|
|
110
123
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
111
124
|
*/
|
|
@@ -113,6 +126,7 @@ export declare class AasRegistryClient {
|
|
|
113
126
|
configuration: Configuration;
|
|
114
127
|
aasIdentifier: string;
|
|
115
128
|
submodelDescriptor: SubmodelDescriptor;
|
|
129
|
+
ifMatch?: string;
|
|
116
130
|
}): Promise<ApiResult<SubmodelDescriptor, AasRegistryService.Result>>;
|
|
117
131
|
/**
|
|
118
132
|
* Returns a specific Submodel Descriptor
|
|
@@ -121,14 +135,16 @@ export declare class AasRegistryClient {
|
|
|
121
135
|
* - configuration: The http request options
|
|
122
136
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
123
137
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
138
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
124
139
|
*
|
|
125
140
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
126
141
|
*/
|
|
127
|
-
getSubmodelDescriptorByIdThroughSuperpath(options: {
|
|
142
|
+
getSubmodelDescriptorByIdThroughSuperpath<IfNoneMatch extends string | undefined = undefined>(options: {
|
|
128
143
|
configuration: Configuration;
|
|
129
144
|
aasIdentifier: string;
|
|
130
145
|
submodelIdentifier: string;
|
|
131
|
-
|
|
146
|
+
ifNoneMatch?: IfNoneMatch;
|
|
147
|
+
}): Promise<ConditionalApiResult<SubmodelDescriptor, AasRegistryService.Result, IfNoneMatch>>;
|
|
132
148
|
/**
|
|
133
149
|
* Deletes a Submodel Descriptor, i.e. de-registers a submodel
|
|
134
150
|
*
|
|
@@ -136,6 +152,7 @@ export declare class AasRegistryClient {
|
|
|
136
152
|
* - configuration: The http request options
|
|
137
153
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
138
154
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
155
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
139
156
|
*
|
|
140
157
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
141
158
|
*/
|
|
@@ -143,6 +160,7 @@ export declare class AasRegistryClient {
|
|
|
143
160
|
configuration: Configuration;
|
|
144
161
|
aasIdentifier: string;
|
|
145
162
|
submodelIdentifier: string;
|
|
163
|
+
ifMatch?: string;
|
|
146
164
|
}): Promise<ApiResult<void, AasRegistryService.Result>>;
|
|
147
165
|
/**
|
|
148
166
|
* Creates or updates an existing Submodel Descriptor
|
|
@@ -152,6 +170,8 @@ export declare class AasRegistryClient {
|
|
|
152
170
|
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
153
171
|
* - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
|
|
154
172
|
* - submodelDescriptor: Submodel Descriptor object
|
|
173
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
174
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
155
175
|
*
|
|
156
176
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
157
177
|
*/
|
|
@@ -160,6 +180,8 @@ export declare class AasRegistryClient {
|
|
|
160
180
|
aasIdentifier: string;
|
|
161
181
|
submodelIdentifier: string;
|
|
162
182
|
submodelDescriptor: SubmodelDescriptor;
|
|
183
|
+
ifMatch?: string;
|
|
184
|
+
ifNoneMatch?: string;
|
|
163
185
|
}): Promise<ApiResult<SubmodelDescriptor | void, AasRegistryService.Result>>;
|
|
164
186
|
/**
|
|
165
187
|
* Returns the self-describing information of a network resource (ServiceDescription)
|