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