basyx-typescript-sdk 2.4.0 → 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.
- package/bundle/index.cjs +51 -16
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +51 -16
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasRepositoryClient.d.ts +11 -3
- package/dist/clients/AasRepositoryClient.js +21 -4
- package/dist/clients/SubmodelRepositoryClient.d.ts +13 -7
- package/dist/clients/SubmodelRepositoryClient.js +21 -12
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +0 -2
- package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +2 -8
- package/dist/lib/operationHandle.d.ts +10 -0
- package/dist/lib/operationHandle.js +26 -0
- package/dist/models/api.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
import type { Query } from '../models/Query';
|
|
5
5
|
import type { QueryResult } from '../models/QueryResult';
|
|
@@ -1038,6 +1038,10 @@ export declare class AasRepositoryClient {
|
|
|
1038
1038
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1039
1039
|
*
|
|
1040
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`).
|
|
1041
1045
|
*/
|
|
1042
1046
|
invokeOperationAsyncAasRepository(options: {
|
|
1043
1047
|
configuration: Configuration;
|
|
@@ -1046,7 +1050,7 @@ export declare class AasRepositoryClient {
|
|
|
1046
1050
|
idShortPath: string;
|
|
1047
1051
|
operationRequest: AasRepositoryService.OperationRequest;
|
|
1048
1052
|
ifMatch?: string;
|
|
1049
|
-
}): Promise<ApiResult<
|
|
1053
|
+
}): Promise<ApiResult<OperationHandle | undefined, AasRepositoryService.Result>>;
|
|
1050
1054
|
/**
|
|
1051
1055
|
* Asynchronously invokes an Operation at a specified path
|
|
1052
1056
|
*
|
|
@@ -1059,6 +1063,10 @@ export declare class AasRepositoryClient {
|
|
|
1059
1063
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1060
1064
|
*
|
|
1061
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`).
|
|
1062
1070
|
*/
|
|
1063
1071
|
invokeOperationAsyncValueOnlyAasRepository(options: {
|
|
1064
1072
|
configuration: Configuration;
|
|
@@ -1067,7 +1075,7 @@ export declare class AasRepositoryClient {
|
|
|
1067
1075
|
idShortPath: string;
|
|
1068
1076
|
operationRequestValueOnly: AasRepositoryService.OperationRequestValueOnly;
|
|
1069
1077
|
ifMatch?: string;
|
|
1070
|
-
}): Promise<ApiResult<
|
|
1078
|
+
}): Promise<ApiResult<OperationHandle | undefined, AasRepositoryService.Result>>;
|
|
1071
1079
|
/**
|
|
1072
1080
|
* Returns the Operation status of an asynchronous invoked Operation
|
|
1073
1081
|
*
|
|
@@ -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 { getOperationHandle } from '../lib/operationHandle';
|
|
9
10
|
import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
|
|
10
11
|
export class AasRepositoryClient {
|
|
11
12
|
static requireIdentifier(value, field) {
|
|
@@ -2071,6 +2072,10 @@ export class AasRepositoryClient {
|
|
|
2071
2072
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
2072
2073
|
*
|
|
2073
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`).
|
|
2074
2079
|
*/
|
|
2075
2080
|
async invokeOperationAsyncAasRepository(options) {
|
|
2076
2081
|
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
@@ -2084,8 +2089,12 @@ export class AasRepositoryClient {
|
|
|
2084
2089
|
idShortPath: idShortPath,
|
|
2085
2090
|
operationRequest: operationRequest,
|
|
2086
2091
|
});
|
|
2087
|
-
|
|
2088
|
-
|
|
2092
|
+
return {
|
|
2093
|
+
success: true,
|
|
2094
|
+
data: getOperationHandle(response.raw),
|
|
2095
|
+
statusCode: response.raw.status,
|
|
2096
|
+
etag: getEtag(response.raw),
|
|
2097
|
+
};
|
|
2089
2098
|
}
|
|
2090
2099
|
catch (err) {
|
|
2091
2100
|
const customError = await handleApiError(err);
|
|
@@ -2109,6 +2118,10 @@ export class AasRepositoryClient {
|
|
|
2109
2118
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
2110
2119
|
*
|
|
2111
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`).
|
|
2112
2125
|
*/
|
|
2113
2126
|
async invokeOperationAsyncValueOnlyAasRepository(options) {
|
|
2114
2127
|
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
@@ -2122,8 +2135,12 @@ export class AasRepositoryClient {
|
|
|
2122
2135
|
idShortPath: idShortPath,
|
|
2123
2136
|
operationRequestValueOnly: operationRequestValueOnly,
|
|
2124
2137
|
});
|
|
2125
|
-
|
|
2126
|
-
|
|
2138
|
+
return {
|
|
2139
|
+
success: true,
|
|
2140
|
+
data: getOperationHandle(response.raw),
|
|
2141
|
+
statusCode: response.raw.status,
|
|
2142
|
+
etag: getEtag(response.raw),
|
|
2143
|
+
};
|
|
2127
2144
|
}
|
|
2128
2145
|
catch (err) {
|
|
2129
2146
|
const customError = await handleApiError(err);
|
|
@@ -1,5 +1,5 @@
|
|
|
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
3
|
import type { Query } from '../models/Query';
|
|
4
4
|
import type { QueryResult } from '../models/QueryResult';
|
|
5
5
|
import { SubmodelRepositoryService } from '../generated';
|
|
@@ -747,7 +747,6 @@ export declare class SubmodelRepositoryClient {
|
|
|
747
747
|
*
|
|
748
748
|
* @param options Object containing:
|
|
749
749
|
* - configuration: The http request options.
|
|
750
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
751
750
|
* - submodelIdentifier: The Submodel’s unique id
|
|
752
751
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
753
752
|
* - operationRequestValueOnly: Operation request object
|
|
@@ -757,7 +756,8 @@ export declare class SubmodelRepositoryClient {
|
|
|
757
756
|
*/
|
|
758
757
|
postInvokeOperationValueOnly(options: {
|
|
759
758
|
configuration: Configuration;
|
|
760
|
-
|
|
759
|
+
/** @deprecated Not part of the Submodel Repository API and ignored */
|
|
760
|
+
aasIdentifier?: string;
|
|
761
761
|
submodelIdentifier: string;
|
|
762
762
|
idShortPath: string;
|
|
763
763
|
operationRequestValueOnly: SubmodelRepositoryService.OperationRequestValueOnly;
|
|
@@ -774,6 +774,9 @@ export declare class SubmodelRepositoryClient {
|
|
|
774
774
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
775
775
|
*
|
|
776
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`).
|
|
777
780
|
*/
|
|
778
781
|
postInvokeOperationAsync(options: {
|
|
779
782
|
configuration: Configuration;
|
|
@@ -781,28 +784,31 @@ export declare class SubmodelRepositoryClient {
|
|
|
781
784
|
idShortPath: string;
|
|
782
785
|
operationRequest: SubmodelRepositoryService.OperationRequest;
|
|
783
786
|
ifMatch?: string;
|
|
784
|
-
}): Promise<ApiResult<
|
|
787
|
+
}): Promise<ApiResult<OperationHandle | undefined, SubmodelRepositoryService.Result>>;
|
|
785
788
|
/**
|
|
786
789
|
* Asynchronously invokes an Operation at a specified path
|
|
787
790
|
*
|
|
788
791
|
* @param options Object containing:
|
|
789
792
|
* - configuration: The http request options.
|
|
790
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
791
793
|
* - submodelIdentifier: The Submodel’s unique id
|
|
792
794
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
793
795
|
* - operationRequestValueOnly: Operation request object
|
|
794
796
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
795
797
|
*
|
|
796
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`).
|
|
797
802
|
*/
|
|
798
803
|
postInvokeOperationAsyncValueOnly(options: {
|
|
799
804
|
configuration: Configuration;
|
|
800
|
-
|
|
805
|
+
/** @deprecated Not part of the Submodel Repository API and ignored */
|
|
806
|
+
aasIdentifier?: string;
|
|
801
807
|
submodelIdentifier: string;
|
|
802
808
|
idShortPath: string;
|
|
803
809
|
operationRequestValueOnly: SubmodelRepositoryService.OperationRequestValueOnly;
|
|
804
810
|
ifMatch?: string;
|
|
805
|
-
}): Promise<ApiResult<
|
|
811
|
+
}): Promise<ApiResult<OperationHandle | undefined, SubmodelRepositoryService.Result>>;
|
|
806
812
|
/**
|
|
807
813
|
* Returns status of an asynchronously invoked operation
|
|
808
814
|
*
|
|
@@ -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 { getOperationHandle } from '../lib/operationHandle';
|
|
8
9
|
import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
|
|
9
10
|
//import { SubmodelElement } from 'src/generated/SubmodelRepositoryService';
|
|
10
11
|
export class SubmodelRepositoryClient {
|
|
@@ -1496,7 +1497,6 @@ export class SubmodelRepositoryClient {
|
|
|
1496
1497
|
*
|
|
1497
1498
|
* @param options Object containing:
|
|
1498
1499
|
* - configuration: The http request options.
|
|
1499
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
1500
1500
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1501
1501
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1502
1502
|
* - operationRequestValueOnly: Operation request object
|
|
@@ -1505,13 +1505,11 @@ export class SubmodelRepositoryClient {
|
|
|
1505
1505
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1506
1506
|
*/
|
|
1507
1507
|
async postInvokeOperationValueOnly(options) {
|
|
1508
|
-
const { configuration,
|
|
1508
|
+
const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
1509
1509
|
try {
|
|
1510
1510
|
const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1511
|
-
const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1512
1511
|
const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1513
1512
|
const response = await apiInstance.invokeOperationValueOnlyRaw({
|
|
1514
|
-
aasIdentifier: encodedAasIdentifier,
|
|
1515
1513
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
1516
1514
|
idShortPath: idShortPath,
|
|
1517
1515
|
operationRequestValueOnly: operationRequestValueOnly,
|
|
@@ -1540,6 +1538,9 @@ export class SubmodelRepositoryClient {
|
|
|
1540
1538
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1541
1539
|
*
|
|
1542
1540
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1541
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
|
|
1542
|
+
* `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
|
|
1543
|
+
* (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
|
|
1543
1544
|
*/
|
|
1544
1545
|
async postInvokeOperationAsync(options) {
|
|
1545
1546
|
const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
@@ -1551,8 +1552,12 @@ export class SubmodelRepositoryClient {
|
|
|
1551
1552
|
idShortPath: idShortPath,
|
|
1552
1553
|
operationRequest: operationRequest,
|
|
1553
1554
|
});
|
|
1554
|
-
|
|
1555
|
-
|
|
1555
|
+
return {
|
|
1556
|
+
success: true,
|
|
1557
|
+
data: getOperationHandle(response.raw),
|
|
1558
|
+
statusCode: response.raw.status,
|
|
1559
|
+
etag: getEtag(response.raw),
|
|
1560
|
+
};
|
|
1556
1561
|
}
|
|
1557
1562
|
catch (err) {
|
|
1558
1563
|
const customError = await handleApiError(err);
|
|
@@ -1569,28 +1574,32 @@ export class SubmodelRepositoryClient {
|
|
|
1569
1574
|
*
|
|
1570
1575
|
* @param options Object containing:
|
|
1571
1576
|
* - configuration: The http request options.
|
|
1572
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
1573
1577
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1574
1578
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1575
1579
|
* - operationRequestValueOnly: Operation request object
|
|
1576
1580
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1577
1581
|
*
|
|
1578
1582
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1583
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
|
|
1584
|
+
* `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
|
|
1585
|
+
* (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
|
|
1579
1586
|
*/
|
|
1580
1587
|
async postInvokeOperationAsyncValueOnly(options) {
|
|
1581
|
-
const { configuration,
|
|
1588
|
+
const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
1582
1589
|
try {
|
|
1583
1590
|
const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1584
|
-
const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1585
1591
|
const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1586
1592
|
const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
|
|
1587
|
-
aasIdentifier: encodedAasIdentifier,
|
|
1588
1593
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
1589
1594
|
idShortPath: idShortPath,
|
|
1590
1595
|
operationRequestValueOnly: operationRequestValueOnly,
|
|
1591
1596
|
});
|
|
1592
|
-
|
|
1593
|
-
|
|
1597
|
+
return {
|
|
1598
|
+
success: true,
|
|
1599
|
+
data: getOperationHandle(response.raw),
|
|
1600
|
+
statusCode: response.raw.status,
|
|
1601
|
+
etag: getEtag(response.raw),
|
|
1602
|
+
};
|
|
1594
1603
|
}
|
|
1595
1604
|
catch (err) {
|
|
1596
1605
|
const customError = await handleApiError(err);
|
|
@@ -159,7 +159,6 @@ export interface InvokeOperationAsyncRequest {
|
|
|
159
159
|
operationRequest: OperationRequest;
|
|
160
160
|
}
|
|
161
161
|
export interface InvokeOperationAsyncValueOnlyRequest {
|
|
162
|
-
aasIdentifier: string;
|
|
163
162
|
submodelIdentifier: string;
|
|
164
163
|
idShortPath: string;
|
|
165
164
|
operationRequestValueOnly: OperationRequestValueOnly;
|
|
@@ -170,7 +169,6 @@ export interface InvokeOperationSubmodelRepoRequest {
|
|
|
170
169
|
operationRequest: OperationRequest;
|
|
171
170
|
}
|
|
172
171
|
export interface InvokeOperationValueOnlyRequest {
|
|
173
|
-
aasIdentifier: string;
|
|
174
172
|
submodelIdentifier: string;
|
|
175
173
|
idShortPath: string;
|
|
176
174
|
operationRequestValueOnly: OperationRequestValueOnly;
|
|
@@ -879,9 +879,6 @@ export class SubmodelRepositoryAPIApi extends runtime.BaseAPI {
|
|
|
879
879
|
* Asynchronously invokes an Operation at a specified path
|
|
880
880
|
*/
|
|
881
881
|
async invokeOperationAsyncValueOnlyRaw(requestParameters, initOverrides) {
|
|
882
|
-
if (requestParameters['aasIdentifier'] == null) {
|
|
883
|
-
throw new runtime.RequiredError('aasIdentifier', 'Required parameter "aasIdentifier" was null or undefined when calling invokeOperationAsyncValueOnly().');
|
|
884
|
-
}
|
|
885
882
|
if (requestParameters['submodelIdentifier'] == null) {
|
|
886
883
|
throw new runtime.RequiredError('submodelIdentifier', 'Required parameter "submodelIdentifier" was null or undefined when calling invokeOperationAsyncValueOnly().');
|
|
887
884
|
}
|
|
@@ -895,7 +892,7 @@ export class SubmodelRepositoryAPIApi extends runtime.BaseAPI {
|
|
|
895
892
|
const headerParameters = {};
|
|
896
893
|
headerParameters['Content-Type'] = 'application/json';
|
|
897
894
|
const response = await this.request({
|
|
898
|
-
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{${"
|
|
895
|
+
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{${"submodelIdentifier"}}`, encodeURIComponent(String(requestParameters['submodelIdentifier']))).replace(`{${"idShortPath"}}`, encodeURIComponent(String(requestParameters['idShortPath']))),
|
|
899
896
|
method: 'POST',
|
|
900
897
|
headers: headerParameters,
|
|
901
898
|
query: queryParameters,
|
|
@@ -945,9 +942,6 @@ export class SubmodelRepositoryAPIApi extends runtime.BaseAPI {
|
|
|
945
942
|
* Synchronously invokes an Operation at a specified path
|
|
946
943
|
*/
|
|
947
944
|
async invokeOperationValueOnlyRaw(requestParameters, initOverrides) {
|
|
948
|
-
if (requestParameters['aasIdentifier'] == null) {
|
|
949
|
-
throw new runtime.RequiredError('aasIdentifier', 'Required parameter "aasIdentifier" was null or undefined when calling invokeOperationValueOnly().');
|
|
950
|
-
}
|
|
951
945
|
if (requestParameters['submodelIdentifier'] == null) {
|
|
952
946
|
throw new runtime.RequiredError('submodelIdentifier', 'Required parameter "submodelIdentifier" was null or undefined when calling invokeOperationValueOnly().');
|
|
953
947
|
}
|
|
@@ -961,7 +955,7 @@ export class SubmodelRepositoryAPIApi extends runtime.BaseAPI {
|
|
|
961
955
|
const headerParameters = {};
|
|
962
956
|
headerParameters['Content-Type'] = 'application/json';
|
|
963
957
|
const response = await this.request({
|
|
964
|
-
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{${"
|
|
958
|
+
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{${"submodelIdentifier"}}`, encodeURIComponent(String(requestParameters['submodelIdentifier']))).replace(`{${"idShortPath"}}`, encodeURIComponent(String(requestParameters['idShortPath']))),
|
|
965
959
|
method: 'POST',
|
|
966
960
|
headers: headerParameters,
|
|
967
961
|
query: queryParameters,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OperationHandle } from '../models/api';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the handle of an asynchronously invoked Operation from the `Location` header of the `202 Accepted`
|
|
4
|
+
* response, or `undefined` if the header is missing or does not point to an `operation-status` resource.
|
|
5
|
+
*
|
|
6
|
+
* The `Location` header may be absolute or a relative reference (RFC 9110, section 10.2.2), e.g.
|
|
7
|
+
* `operation-status/{handleId}` relative to the invocation URL. It is returned unchanged. The handle id is
|
|
8
|
+
* URL-decoded, so it can be passed to `getOperationAsyncStatus` and `getOperationAsyncResult` as is.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getOperationHandle(response: unknown): OperationHandle | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const OPERATION_STATUS_SEGMENT = /(?:^|\/)operation-status\/([^/?#]+)\/?(?:[?#].*)?$/;
|
|
2
|
+
/**
|
|
3
|
+
* Returns the handle of an asynchronously invoked Operation from the `Location` header of the `202 Accepted`
|
|
4
|
+
* response, or `undefined` if the header is missing or does not point to an `operation-status` resource.
|
|
5
|
+
*
|
|
6
|
+
* The `Location` header may be absolute or a relative reference (RFC 9110, section 10.2.2), e.g.
|
|
7
|
+
* `operation-status/{handleId}` relative to the invocation URL. It is returned unchanged. The handle id is
|
|
8
|
+
* URL-decoded, so it can be passed to `getOperationAsyncStatus` and `getOperationAsyncResult` as is.
|
|
9
|
+
*/
|
|
10
|
+
export function getOperationHandle(response) {
|
|
11
|
+
const headers = response?.headers;
|
|
12
|
+
if (typeof headers?.get !== 'function') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const location = headers.get('Location');
|
|
16
|
+
const encodedHandleId = location?.match(OPERATION_STATUS_SEGMENT)?.[1];
|
|
17
|
+
if (location == null || encodedHandleId === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return { handleId: decodeURIComponent(encodedHandleId), location };
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return { handleId: encodedHandleId, location };
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/models/api.d.ts
CHANGED
|
@@ -39,6 +39,16 @@ export type NotModifiedResult = {
|
|
|
39
39
|
* it is, so only callers who opt in have to handle `notModified`.
|
|
40
40
|
*/
|
|
41
41
|
export type ConditionalApiResult<T, E, IfNoneMatch extends string | undefined = string> = ApiResult<T, E> | (IfNoneMatch extends undefined ? never : NotModifiedResult);
|
|
42
|
+
/**
|
|
43
|
+
* Handle of an asynchronously invoked Operation, taken from the `Location` header of the `202 Accepted` response.
|
|
44
|
+
*
|
|
45
|
+
* - `handleId`: the id to pass to `getOperationAsyncStatus` and `getOperationAsyncResult`
|
|
46
|
+
* - `location`: the `Location` header as sent by the server, i.e. the URL of the Operation status
|
|
47
|
+
*/
|
|
48
|
+
export type OperationHandle = {
|
|
49
|
+
handleId: string;
|
|
50
|
+
location: string;
|
|
51
|
+
};
|
|
42
52
|
/**
|
|
43
53
|
* Conditional request headers (RFC 9110). Entity tags are opaque and sent unchanged.
|
|
44
54
|
*/
|
package/package.json
CHANGED