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
package/bundle/index.mjs
CHANGED
|
@@ -2671,7 +2671,6 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
|
|
|
2671
2671
|
* Asynchronously invokes an Operation at a specified path
|
|
2672
2672
|
*/
|
|
2673
2673
|
async invokeOperationAsyncValueOnlyRaw(requestParameters, initOverrides) {
|
|
2674
|
-
if (requestParameters["aasIdentifier"] == null) throw new RequiredError("aasIdentifier", "Required parameter \"aasIdentifier\" was null or undefined when calling invokeOperationAsyncValueOnly().");
|
|
2675
2674
|
if (requestParameters["submodelIdentifier"] == null) throw new RequiredError("submodelIdentifier", "Required parameter \"submodelIdentifier\" was null or undefined when calling invokeOperationAsyncValueOnly().");
|
|
2676
2675
|
if (requestParameters["idShortPath"] == null) throw new RequiredError("idShortPath", "Required parameter \"idShortPath\" was null or undefined when calling invokeOperationAsyncValueOnly().");
|
|
2677
2676
|
if (requestParameters["operationRequestValueOnly"] == null) throw new RequiredError("operationRequestValueOnly", "Required parameter \"operationRequestValueOnly\" was null or undefined when calling invokeOperationAsyncValueOnly().");
|
|
@@ -2679,7 +2678,7 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
|
|
|
2679
2678
|
const headerParameters = {};
|
|
2680
2679
|
headerParameters["Content-Type"] = "application/json";
|
|
2681
2680
|
return new VoidApiResponse(await this.request({
|
|
2682
|
-
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{
|
|
2681
|
+
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value`.replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
|
|
2683
2682
|
method: "POST",
|
|
2684
2683
|
headers: headerParameters,
|
|
2685
2684
|
query: queryParameters,
|
|
@@ -2720,7 +2719,6 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
|
|
|
2720
2719
|
* Synchronously invokes an Operation at a specified path
|
|
2721
2720
|
*/
|
|
2722
2721
|
async invokeOperationValueOnlyRaw(requestParameters, initOverrides) {
|
|
2723
|
-
if (requestParameters["aasIdentifier"] == null) throw new RequiredError("aasIdentifier", "Required parameter \"aasIdentifier\" was null or undefined when calling invokeOperationValueOnly().");
|
|
2724
2722
|
if (requestParameters["submodelIdentifier"] == null) throw new RequiredError("submodelIdentifier", "Required parameter \"submodelIdentifier\" was null or undefined when calling invokeOperationValueOnly().");
|
|
2725
2723
|
if (requestParameters["idShortPath"] == null) throw new RequiredError("idShortPath", "Required parameter \"idShortPath\" was null or undefined when calling invokeOperationValueOnly().");
|
|
2726
2724
|
if (requestParameters["operationRequestValueOnly"] == null) throw new RequiredError("operationRequestValueOnly", "Required parameter \"operationRequestValueOnly\" was null or undefined when calling invokeOperationValueOnly().");
|
|
@@ -2728,7 +2726,7 @@ var SubmodelRepositoryAPIApi = class extends BaseAPI {
|
|
|
2728
2726
|
const headerParameters = {};
|
|
2729
2727
|
headerParameters["Content-Type"] = "application/json";
|
|
2730
2728
|
return new JSONApiResponse(await this.request({
|
|
2731
|
-
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{
|
|
2729
|
+
path: `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value`.replace(`{submodelIdentifier}`, encodeURIComponent(String(requestParameters["submodelIdentifier"]))).replace(`{idShortPath}`, encodeURIComponent(String(requestParameters["idShortPath"]))),
|
|
2732
2730
|
method: "POST",
|
|
2733
2731
|
headers: headerParameters,
|
|
2734
2732
|
query: queryParameters,
|
|
@@ -27997,6 +27995,35 @@ function convertCoreSubmodelElementToApiSubmodelElement(submodelElement) {
|
|
|
27997
27995
|
return JSON.parse(submodelElementStr);
|
|
27998
27996
|
}
|
|
27999
27997
|
//#endregion
|
|
27998
|
+
//#region dist/lib/operationHandle.js
|
|
27999
|
+
const OPERATION_STATUS_SEGMENT = /(?:^|\/)operation-status\/([^/?#]+)\/?(?:[?#].*)?$/;
|
|
28000
|
+
/**
|
|
28001
|
+
* Returns the handle of an asynchronously invoked Operation from the `Location` header of the `202 Accepted`
|
|
28002
|
+
* response, or `undefined` if the header is missing or does not point to an `operation-status` resource.
|
|
28003
|
+
*
|
|
28004
|
+
* The `Location` header may be absolute or a relative reference (RFC 9110, section 10.2.2), e.g.
|
|
28005
|
+
* `operation-status/{handleId}` relative to the invocation URL. It is returned unchanged. The handle id is
|
|
28006
|
+
* URL-decoded, so it can be passed to `getOperationAsyncStatus` and `getOperationAsyncResult` as is.
|
|
28007
|
+
*/
|
|
28008
|
+
function getOperationHandle(response) {
|
|
28009
|
+
const headers = response?.headers;
|
|
28010
|
+
if (typeof headers?.get !== "function") return;
|
|
28011
|
+
const location = headers.get("Location");
|
|
28012
|
+
const encodedHandleId = location?.match(OPERATION_STATUS_SEGMENT)?.[1];
|
|
28013
|
+
if (location == null || encodedHandleId === void 0) return;
|
|
28014
|
+
try {
|
|
28015
|
+
return {
|
|
28016
|
+
handleId: decodeURIComponent(encodedHandleId),
|
|
28017
|
+
location
|
|
28018
|
+
};
|
|
28019
|
+
} catch {
|
|
28020
|
+
return {
|
|
28021
|
+
handleId: encodedHandleId,
|
|
28022
|
+
location
|
|
28023
|
+
};
|
|
28024
|
+
}
|
|
28025
|
+
}
|
|
28026
|
+
//#endregion
|
|
28000
28027
|
//#region dist/clients/AasRepositoryClient.js
|
|
28001
28028
|
var AasRepositoryClient = class AasRepositoryClient {
|
|
28002
28029
|
static requireIdentifier(value, field) {
|
|
@@ -30074,6 +30101,10 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
30074
30101
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
30075
30102
|
*
|
|
30076
30103
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
30104
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for
|
|
30105
|
+
* `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
|
|
30106
|
+
* sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
|
|
30107
|
+
* `Access-Control-Expose-Headers`).
|
|
30077
30108
|
*/
|
|
30078
30109
|
async invokeOperationAsyncAasRepository(options) {
|
|
30079
30110
|
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
@@ -30089,7 +30120,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
30089
30120
|
});
|
|
30090
30121
|
return {
|
|
30091
30122
|
success: true,
|
|
30092
|
-
data:
|
|
30123
|
+
data: getOperationHandle(response.raw),
|
|
30093
30124
|
statusCode: response.raw.status,
|
|
30094
30125
|
etag: getEtag(response.raw)
|
|
30095
30126
|
};
|
|
@@ -30115,6 +30146,10 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
30115
30146
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
30116
30147
|
*
|
|
30117
30148
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
30149
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for
|
|
30150
|
+
* `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
|
|
30151
|
+
* sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
|
|
30152
|
+
* `Access-Control-Expose-Headers`).
|
|
30118
30153
|
*/
|
|
30119
30154
|
async invokeOperationAsyncValueOnlyAasRepository(options) {
|
|
30120
30155
|
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
@@ -30130,7 +30165,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
30130
30165
|
});
|
|
30131
30166
|
return {
|
|
30132
30167
|
success: true,
|
|
30133
|
-
data:
|
|
30168
|
+
data: getOperationHandle(response.raw),
|
|
30134
30169
|
statusCode: response.raw.status,
|
|
30135
30170
|
etag: getEtag(response.raw)
|
|
30136
30171
|
};
|
|
@@ -32688,7 +32723,6 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32688
32723
|
*
|
|
32689
32724
|
* @param options Object containing:
|
|
32690
32725
|
* - configuration: The http request options.
|
|
32691
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
32692
32726
|
* - submodelIdentifier: The Submodel’s unique id
|
|
32693
32727
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
32694
32728
|
* - operationRequestValueOnly: Operation request object
|
|
@@ -32697,13 +32731,11 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32697
32731
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
32698
32732
|
*/
|
|
32699
32733
|
async postInvokeOperationValueOnly(options) {
|
|
32700
|
-
const { configuration,
|
|
32734
|
+
const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
32701
32735
|
try {
|
|
32702
32736
|
const apiInstance = new SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
32703
|
-
const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, "aasIdentifier"));
|
|
32704
32737
|
const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, "submodelIdentifier"));
|
|
32705
32738
|
const response = await apiInstance.invokeOperationValueOnlyRaw({
|
|
32706
|
-
aasIdentifier: encodedAasIdentifier,
|
|
32707
32739
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
32708
32740
|
idShortPath,
|
|
32709
32741
|
operationRequestValueOnly
|
|
@@ -32735,6 +32767,9 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32735
32767
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
32736
32768
|
*
|
|
32737
32769
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
32770
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
|
|
32771
|
+
* `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
|
|
32772
|
+
* (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
|
|
32738
32773
|
*/
|
|
32739
32774
|
async postInvokeOperationAsync(options) {
|
|
32740
32775
|
const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
@@ -32748,7 +32783,7 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32748
32783
|
});
|
|
32749
32784
|
return {
|
|
32750
32785
|
success: true,
|
|
32751
|
-
data:
|
|
32786
|
+
data: getOperationHandle(response.raw),
|
|
32752
32787
|
statusCode: response.raw.status,
|
|
32753
32788
|
etag: getEtag(response.raw)
|
|
32754
32789
|
};
|
|
@@ -32767,29 +32802,29 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32767
32802
|
*
|
|
32768
32803
|
* @param options Object containing:
|
|
32769
32804
|
* - configuration: The http request options.
|
|
32770
|
-
* - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
|
|
32771
32805
|
* - submodelIdentifier: The Submodel’s unique id
|
|
32772
32806
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
32773
32807
|
* - operationRequestValueOnly: Operation request object
|
|
32774
32808
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
32775
32809
|
*
|
|
32776
32810
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
32811
|
+
* `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
|
|
32812
|
+
* `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
|
|
32813
|
+
* (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
|
|
32777
32814
|
*/
|
|
32778
32815
|
async postInvokeOperationAsyncValueOnly(options) {
|
|
32779
|
-
const { configuration,
|
|
32816
|
+
const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
32780
32817
|
try {
|
|
32781
32818
|
const apiInstance = new SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
32782
|
-
const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, "aasIdentifier"));
|
|
32783
32819
|
const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, "submodelIdentifier"));
|
|
32784
32820
|
const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
|
|
32785
|
-
aasIdentifier: encodedAasIdentifier,
|
|
32786
32821
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
32787
32822
|
idShortPath,
|
|
32788
32823
|
operationRequestValueOnly
|
|
32789
32824
|
});
|
|
32790
32825
|
return {
|
|
32791
32826
|
success: true,
|
|
32792
|
-
data:
|
|
32827
|
+
data: getOperationHandle(response.raw),
|
|
32793
32828
|
statusCode: response.raw.status,
|
|
32794
32829
|
etag: getEtag(response.raw)
|
|
32795
32830
|
};
|