basyx-typescript-sdk 2.4.0 → 2.4.2

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.
@@ -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';
@@ -217,7 +217,7 @@ export declare class AasRepositoryClient {
217
217
  * @param options Object containing:
218
218
  * - configuration: The http request options
219
219
  * - aasIdentifier: The Asset Administration Shell’s unique id
220
- * - fileName: The name of the file
220
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
221
221
  * - file: The file to upload
222
222
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
223
223
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -948,7 +948,7 @@ export declare class AasRepositoryClient {
948
948
  * - aasIdentifier: The Asset Administration Shell’s unique id
949
949
  * - submodelIdentifier: The Submodel’s unique id
950
950
  * - idShortPath: IdShort path to the submodel element (dot-separated)
951
- * - fileName: The name of the file
951
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
952
952
  * - file: The file to upload
953
953
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
954
954
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -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<void, AasRepositoryService.Result>>;
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<void, AasRepositoryService.Result>>;
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,8 @@ 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 { withFileName } from '../lib/multipartFile';
10
+ import { getOperationHandle } from '../lib/operationHandle';
9
11
  import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
10
12
  export class AasRepositoryClient {
11
13
  static requireIdentifier(value, field) {
@@ -488,7 +490,7 @@ export class AasRepositoryClient {
488
490
  * @param options Object containing:
489
491
  * - configuration: The http request options
490
492
  * - aasIdentifier: The Asset Administration Shell’s unique id
491
- * - fileName: The name of the file
493
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
492
494
  * - file: The file to upload
493
495
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
494
496
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -503,7 +505,7 @@ export class AasRepositoryClient {
503
505
  const response = await apiInstance.putThumbnailAasRepositoryRaw({
504
506
  aasIdentifier: encodedAasIdentifier,
505
507
  fileName: fileName,
506
- file: file,
508
+ file: withFileName(file, fileName),
507
509
  });
508
510
  const result = await response.value();
509
511
  return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
@@ -1914,7 +1916,7 @@ export class AasRepositoryClient {
1914
1916
  * - aasIdentifier: The Asset Administration Shell’s unique id
1915
1917
  * - submodelIdentifier: The Submodel’s unique id
1916
1918
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1917
- * - fileName: The name of the file
1919
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
1918
1920
  * - file: The file to upload
1919
1921
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1920
1922
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -1932,7 +1934,7 @@ export class AasRepositoryClient {
1932
1934
  submodelIdentifier: encodedSubmodelIdentifier,
1933
1935
  idShortPath: idShortPath,
1934
1936
  fileName: fileName,
1935
- file: file,
1937
+ file: withFileName(file, fileName),
1936
1938
  });
1937
1939
  const result = await response.value();
1938
1940
  return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
@@ -2071,6 +2073,10 @@ export class AasRepositoryClient {
2071
2073
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
2072
2074
  *
2073
2075
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
2076
+ * `data` is the handle of the invocation, taken from the `Location` header, for
2077
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
2078
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
2079
+ * `Access-Control-Expose-Headers`).
2074
2080
  */
2075
2081
  async invokeOperationAsyncAasRepository(options) {
2076
2082
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
@@ -2084,8 +2090,12 @@ export class AasRepositoryClient {
2084
2090
  idShortPath: idShortPath,
2085
2091
  operationRequest: operationRequest,
2086
2092
  });
2087
- const result = await response.value();
2088
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
2093
+ return {
2094
+ success: true,
2095
+ data: getOperationHandle(response.raw),
2096
+ statusCode: response.raw.status,
2097
+ etag: getEtag(response.raw),
2098
+ };
2089
2099
  }
2090
2100
  catch (err) {
2091
2101
  const customError = await handleApiError(err);
@@ -2109,6 +2119,10 @@ export class AasRepositoryClient {
2109
2119
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
2110
2120
  *
2111
2121
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
2122
+ * `data` is the handle of the invocation, taken from the `Location` header, for
2123
+ * `getOperationAsyncStatusAasRepository` and `getOperationAsyncResultAasRepository`. It is `undefined` if the server
2124
+ * sends no `Location` header or the client cannot read it (in browsers, the server must list `Location` in
2125
+ * `Access-Control-Expose-Headers`).
2112
2126
  */
2113
2127
  async invokeOperationAsyncValueOnlyAasRepository(options) {
2114
2128
  const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
@@ -2122,8 +2136,12 @@ export class AasRepositoryClient {
2122
2136
  idShortPath: idShortPath,
2123
2137
  operationRequestValueOnly: operationRequestValueOnly,
2124
2138
  });
2125
- const result = await response.value();
2126
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
2139
+ return {
2140
+ success: true,
2141
+ data: getOperationHandle(response.raw),
2142
+ statusCode: response.raw.status,
2143
+ etag: getEtag(response.raw),
2144
+ };
2127
2145
  }
2128
2146
  catch (err) {
2129
2147
  const customError = await handleApiError(err);
@@ -31,7 +31,7 @@ export declare class AasxFileClient {
31
31
  * - configuration: The http request options.
32
32
  * - aasIds?: A list of Asset Administration Shells' unique ids
33
33
  * - file: The file to upload
34
- * - fileName: The name of the file
34
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
35
35
  *
36
36
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
37
37
  */
@@ -64,7 +64,7 @@ export declare class AasxFileClient {
64
64
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
65
65
  * - aasIds?: A list of Asset Administration Shells' unique ids
66
66
  * - file: The file to upload
67
- * - fileName: The name of the file
67
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
68
68
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
69
69
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
70
70
  *
@@ -4,6 +4,7 @@ import { applyDefaults } from '../lib/apiConfig';
4
4
  import { base64Encode } from '../lib/base64Url';
5
5
  import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
6
6
  import { handleApiError } from '../lib/errorHandler';
7
+ import { withFileName } from '../lib/multipartFile';
7
8
  export class AasxFileClient {
8
9
  static requireIdentifier(value, field) {
9
10
  if (value === null || value === undefined || value.trim() === '') {
@@ -74,7 +75,7 @@ export class AasxFileClient {
74
75
  * - configuration: The http request options.
75
76
  * - aasIds?: A list of Asset Administration Shells' unique ids
76
77
  * - file: The file to upload
77
- * - fileName: The name of the file
78
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
78
79
  *
79
80
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
80
81
  */
@@ -84,7 +85,7 @@ export class AasxFileClient {
84
85
  const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
85
86
  const response = await apiInstance.postAASXPackageRaw({
86
87
  aasIds: aasIds,
87
- file: file,
88
+ file: withFileName(file, fileName),
88
89
  fileName: fileName,
89
90
  });
90
91
  const result = await response.value();
@@ -143,7 +144,7 @@ export class AasxFileClient {
143
144
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
144
145
  * - aasIds?: A list of Asset Administration Shells' unique ids
145
146
  * - file: The file to upload
146
- * - fileName: The name of the file
147
+ * - fileName: The name of the file, sent as filename of the file part and as `fileName` field
147
148
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
148
149
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
149
150
  *
@@ -157,7 +158,7 @@ export class AasxFileClient {
157
158
  const response = await apiInstance.putAASXByPackageIdRaw({
158
159
  packageId: encodedPackageId,
159
160
  aasIds: aasIds,
160
- file: file,
161
+ file: withFileName(file, fileName),
161
162
  fileName: fileName,
162
163
  });
163
164
  const result = await response.value();
@@ -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';
@@ -689,7 +689,7 @@ export declare class SubmodelRepositoryClient {
689
689
  * - configuration: The http request options
690
690
  * - submodelIdentifier: The Submodel's unique id
691
691
  * - idShortPath: IdShort path to the submodel element (dot-separated)
692
- * - fileName?: Name of the uploaded file
692
+ * - fileName?: Name of the uploaded file, sent as filename of the file part and as `fileName` field
693
693
  * - file?: File content
694
694
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
695
695
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -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
- aasIdentifier: string;
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<void, SubmodelRepositoryService.Result>>;
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
- aasIdentifier: string;
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<void, SubmodelRepositoryService.Result>>;
811
+ }): Promise<ApiResult<OperationHandle | undefined, SubmodelRepositoryService.Result>>;
806
812
  /**
807
813
  * Returns status of an asynchronously invoked operation
808
814
  *
@@ -5,6 +5,8 @@ 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 { withFileName } from '../lib/multipartFile';
9
+ import { getOperationHandle } from '../lib/operationHandle';
8
10
  import { convertQueryResult, toQueryRequestBody } from '../lib/queryRequests';
9
11
  //import { SubmodelElement } from 'src/generated/SubmodelRepositoryService';
10
12
  export class SubmodelRepositoryClient {
@@ -1390,7 +1392,7 @@ export class SubmodelRepositoryClient {
1390
1392
  * - configuration: The http request options
1391
1393
  * - submodelIdentifier: The Submodel's unique id
1392
1394
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1393
- * - fileName?: Name of the uploaded file
1395
+ * - fileName?: Name of the uploaded file, sent as filename of the file part and as `fileName` field
1394
1396
  * - file?: File content
1395
1397
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1396
1398
  * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
@@ -1406,7 +1408,7 @@ export class SubmodelRepositoryClient {
1406
1408
  submodelIdentifier: encodedSubmodelIdentifier,
1407
1409
  idShortPath: idShortPath,
1408
1410
  fileName: fileName,
1409
- file: file,
1411
+ file: file && withFileName(file, fileName),
1410
1412
  });
1411
1413
  const result = await response.value();
1412
1414
  return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
@@ -1496,7 +1498,6 @@ export class SubmodelRepositoryClient {
1496
1498
  *
1497
1499
  * @param options Object containing:
1498
1500
  * - configuration: The http request options.
1499
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
1500
1501
  * - submodelIdentifier: The Submodel’s unique id
1501
1502
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1502
1503
  * - operationRequestValueOnly: Operation request object
@@ -1505,13 +1506,11 @@ export class SubmodelRepositoryClient {
1505
1506
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1506
1507
  */
1507
1508
  async postInvokeOperationValueOnly(options) {
1508
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1509
+ const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1509
1510
  try {
1510
1511
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1511
- const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1512
1512
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1513
1513
  const response = await apiInstance.invokeOperationValueOnlyRaw({
1514
- aasIdentifier: encodedAasIdentifier,
1515
1514
  submodelIdentifier: encodedSubmodelIdentifier,
1516
1515
  idShortPath: idShortPath,
1517
1516
  operationRequestValueOnly: operationRequestValueOnly,
@@ -1540,6 +1539,9 @@ export class SubmodelRepositoryClient {
1540
1539
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1541
1540
  *
1542
1541
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1542
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
1543
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
1544
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
1543
1545
  */
1544
1546
  async postInvokeOperationAsync(options) {
1545
1547
  const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
@@ -1551,8 +1553,12 @@ export class SubmodelRepositoryClient {
1551
1553
  idShortPath: idShortPath,
1552
1554
  operationRequest: operationRequest,
1553
1555
  });
1554
- const result = await response.value();
1555
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1556
+ return {
1557
+ success: true,
1558
+ data: getOperationHandle(response.raw),
1559
+ statusCode: response.raw.status,
1560
+ etag: getEtag(response.raw),
1561
+ };
1556
1562
  }
1557
1563
  catch (err) {
1558
1564
  const customError = await handleApiError(err);
@@ -1569,28 +1575,32 @@ export class SubmodelRepositoryClient {
1569
1575
  *
1570
1576
  * @param options Object containing:
1571
1577
  * - configuration: The http request options.
1572
- * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
1573
1578
  * - submodelIdentifier: The Submodel’s unique id
1574
1579
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1575
1580
  * - operationRequestValueOnly: Operation request object
1576
1581
  * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1577
1582
  *
1578
1583
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1584
+ * `data` is the handle of the invocation, taken from the `Location` header, for `getOperationAsyncStatus` and
1585
+ * `getOperationAsyncResult`. It is `undefined` if the server sends no `Location` header or the client cannot read it
1586
+ * (in browsers, the server must list `Location` in `Access-Control-Expose-Headers`).
1579
1587
  */
1580
1588
  async postInvokeOperationAsyncValueOnly(options) {
1581
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1589
+ const { configuration, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1582
1590
  try {
1583
1591
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1584
- const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1585
1592
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1586
1593
  const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
1587
- aasIdentifier: encodedAasIdentifier,
1588
1594
  submodelIdentifier: encodedSubmodelIdentifier,
1589
1595
  idShortPath: idShortPath,
1590
1596
  operationRequestValueOnly: operationRequestValueOnly,
1591
1597
  });
1592
- const result = await response.value();
1593
- return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1598
+ return {
1599
+ success: true,
1600
+ data: getOperationHandle(response.raw),
1601
+ statusCode: response.raw.status,
1602
+ etag: getEtag(response.raw),
1603
+ };
1594
1604
  }
1595
1605
  catch (err) {
1596
1606
  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(`{${"aasIdentifier"}}`, encodeURIComponent(String(requestParameters['aasIdentifier']))).replace(`{${"submodelIdentifier"}}`, encodeURIComponent(String(requestParameters['submodelIdentifier']))).replace(`{${"idShortPath"}}`, encodeURIComponent(String(requestParameters['idShortPath']))),
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(`{${"aasIdentifier"}}`, encodeURIComponent(String(requestParameters['aasIdentifier']))).replace(`{${"submodelIdentifier"}}`, encodeURIComponent(String(requestParameters['submodelIdentifier']))).replace(`{${"idShortPath"}}`, encodeURIComponent(String(requestParameters['idShortPath']))),
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,11 @@
1
+ /**
2
+ * Names a file for a multipart upload, so that the name is sent as the `filename` parameter of the
3
+ * file part's `Content-Disposition` header. AAS Part 2 V3.2 reads the file name only from there;
4
+ * a plain `Blob` would otherwise be sent with the default name `blob`.
5
+ *
6
+ * @function withFileName
7
+ * @param {Blob} file - The file content to upload.
8
+ * @param {string} [fileName] - The requested file name. Without a name, the file is returned unchanged.
9
+ * @returns {Blob} A `File` with the requested name and the content type of the given file.
10
+ */
11
+ export declare function withFileName(file: Blob, fileName?: string): Blob;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Names a file for a multipart upload, so that the name is sent as the `filename` parameter of the
3
+ * file part's `Content-Disposition` header. AAS Part 2 V3.2 reads the file name only from there;
4
+ * a plain `Blob` would otherwise be sent with the default name `blob`.
5
+ *
6
+ * @function withFileName
7
+ * @param {Blob} file - The file content to upload.
8
+ * @param {string} [fileName] - The requested file name. Without a name, the file is returned unchanged.
9
+ * @returns {Blob} A `File` with the requested name and the content type of the given file.
10
+ */
11
+ export function withFileName(file, fileName) {
12
+ const name = fileName?.trim();
13
+ if (!name)
14
+ return file;
15
+ if (file instanceof File && file.name === name)
16
+ return file;
17
+ return new File([file], name, { type: file.type });
18
+ }
@@ -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
+ }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basyx-typescript-sdk",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)",
5
5
  "main": "bundle/index.cjs",
6
6
  "module": "bundle/index.mjs",