basyx-typescript-sdk 2.4.1 → 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.
- package/bundle/index.cjs +32 -14
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +32 -14
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasRepositoryClient.d.ts +2 -2
- package/dist/clients/AasRepositoryClient.js +5 -4
- package/dist/clients/AasxFileClient.d.ts +2 -2
- package/dist/clients/AasxFileClient.js +5 -4
- package/dist/clients/SubmodelRepositoryClient.d.ts +1 -1
- package/dist/clients/SubmodelRepositoryClient.js +3 -2
- package/dist/lib/multipartFile.d.ts +11 -0
- package/dist/lib/multipartFile.js +18 -0
- package/package.json +1 -1
package/bundle/index.cjs
CHANGED
|
@@ -7920,7 +7920,7 @@ function base64Decode$1(text) {
|
|
|
7920
7920
|
*
|
|
7921
7921
|
* @remarks
|
|
7922
7922
|
* The value is an URI that can represent an absolute or relative path.
|
|
7923
|
-
*/ var File = class extends Class {
|
|
7923
|
+
*/ var File$1 = class extends Class {
|
|
7924
7924
|
/**
|
|
7925
7925
|
* Indicate the runtime model type of the instance.
|
|
7926
7926
|
*/ modelType() {
|
|
@@ -11917,7 +11917,7 @@ const AS_DATA_ELEMENT_TRANSFORMER = new AsDataElementTransformer();
|
|
|
11917
11917
|
* @param that - instance to be type-checked
|
|
11918
11918
|
* @returns `true` if the type check is successful
|
|
11919
11919
|
*/ function isFile(that) {
|
|
11920
|
-
return that instanceof File;
|
|
11920
|
+
return that instanceof File$1;
|
|
11921
11921
|
}
|
|
11922
11922
|
/**
|
|
11923
11923
|
* Check the type of `that` instance.
|
|
@@ -17457,7 +17457,7 @@ function fileFromJsonable(jsonable) {
|
|
|
17457
17457
|
}
|
|
17458
17458
|
if (setter.modelType === null) return newDeserializationError("The required property 'modelType' is missing");
|
|
17459
17459
|
else if (setter.modelType != "File") return newDeserializationError(`Expected model type 'File', but got: ${setter.modelType}`);
|
|
17460
|
-
return new Either(new File(setter.extensions, setter.category, setter.idShort, setter.displayName, setter.description, setter.semanticId, setter.supplementalSemanticIds, setter.qualifiers, setter.embeddedDataSpecifications, setter.value, setter.contentType), null);
|
|
17460
|
+
return new Either(new File$1(setter.extensions, setter.category, setter.idShort, setter.displayName, setter.description, setter.semanticId, setter.supplementalSemanticIds, setter.qualifiers, setter.embeddedDataSpecifications, setter.value, setter.contentType), null);
|
|
17461
17461
|
}
|
|
17462
17462
|
/**
|
|
17463
17463
|
* Provide de-serialize & set methods for properties
|
|
@@ -27996,6 +27996,24 @@ function convertCoreSubmodelElementToApiSubmodelElement(submodelElement) {
|
|
|
27996
27996
|
return JSON.parse(submodelElementStr);
|
|
27997
27997
|
}
|
|
27998
27998
|
//#endregion
|
|
27999
|
+
//#region dist/lib/multipartFile.js
|
|
28000
|
+
/**
|
|
28001
|
+
* Names a file for a multipart upload, so that the name is sent as the `filename` parameter of the
|
|
28002
|
+
* file part's `Content-Disposition` header. AAS Part 2 V3.2 reads the file name only from there;
|
|
28003
|
+
* a plain `Blob` would otherwise be sent with the default name `blob`.
|
|
28004
|
+
*
|
|
28005
|
+
* @function withFileName
|
|
28006
|
+
* @param {Blob} file - The file content to upload.
|
|
28007
|
+
* @param {string} [fileName] - The requested file name. Without a name, the file is returned unchanged.
|
|
28008
|
+
* @returns {Blob} A `File` with the requested name and the content type of the given file.
|
|
28009
|
+
*/
|
|
28010
|
+
function withFileName(file, fileName) {
|
|
28011
|
+
const name = fileName?.trim();
|
|
28012
|
+
if (!name) return file;
|
|
28013
|
+
if (file instanceof File && file.name === name) return file;
|
|
28014
|
+
return new File([file], name, { type: file.type });
|
|
28015
|
+
}
|
|
28016
|
+
//#endregion
|
|
27999
28017
|
//#region dist/lib/operationHandle.js
|
|
28000
28018
|
const OPERATION_STATUS_SEGMENT = /(?:^|\/)operation-status\/([^/?#]+)\/?(?:[?#].*)?$/;
|
|
28001
28019
|
/**
|
|
@@ -28492,7 +28510,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
28492
28510
|
* @param options Object containing:
|
|
28493
28511
|
* - configuration: The http request options
|
|
28494
28512
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
28495
|
-
* - fileName: The name of the file
|
|
28513
|
+
* - fileName: The name of the file, sent as filename of the file part and as `fileName` field
|
|
28496
28514
|
* - file: The file to upload
|
|
28497
28515
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
28498
28516
|
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
@@ -28510,7 +28528,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
28510
28528
|
const response = await apiInstance.putThumbnailAasRepositoryRaw({
|
|
28511
28529
|
aasIdentifier: encodedAasIdentifier,
|
|
28512
28530
|
fileName,
|
|
28513
|
-
file
|
|
28531
|
+
file: withFileName(file, fileName)
|
|
28514
28532
|
});
|
|
28515
28533
|
return {
|
|
28516
28534
|
success: true,
|
|
@@ -29930,7 +29948,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
29930
29948
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
29931
29949
|
* - submodelIdentifier: The Submodel’s unique id
|
|
29932
29950
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
29933
|
-
* - fileName: The name of the file
|
|
29951
|
+
* - fileName: The name of the file, sent as filename of the file part and as `fileName` field
|
|
29934
29952
|
* - file: The file to upload
|
|
29935
29953
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
29936
29954
|
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
@@ -29951,7 +29969,7 @@ var AasRepositoryClient = class AasRepositoryClient {
|
|
|
29951
29969
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
29952
29970
|
idShortPath,
|
|
29953
29971
|
fileName,
|
|
29954
|
-
file
|
|
29972
|
+
file: withFileName(file, fileName)
|
|
29955
29973
|
});
|
|
29956
29974
|
return {
|
|
29957
29975
|
success: true,
|
|
@@ -30432,7 +30450,7 @@ var AasxFileClient = class AasxFileClient {
|
|
|
30432
30450
|
* - configuration: The http request options.
|
|
30433
30451
|
* - aasIds?: A list of Asset Administration Shells' unique ids
|
|
30434
30452
|
* - file: The file to upload
|
|
30435
|
-
* - fileName: The name of the file
|
|
30453
|
+
* - fileName: The name of the file, sent as filename of the file part and as `fileName` field
|
|
30436
30454
|
*
|
|
30437
30455
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
30438
30456
|
*/
|
|
@@ -30441,7 +30459,7 @@ var AasxFileClient = class AasxFileClient {
|
|
|
30441
30459
|
try {
|
|
30442
30460
|
const response = await new AASXFileServerAPIApi(applyDefaults(configuration)).postAASXPackageRaw({
|
|
30443
30461
|
aasIds,
|
|
30444
|
-
file,
|
|
30462
|
+
file: withFileName(file, fileName),
|
|
30445
30463
|
fileName
|
|
30446
30464
|
});
|
|
30447
30465
|
return {
|
|
@@ -30502,7 +30520,7 @@ var AasxFileClient = class AasxFileClient {
|
|
|
30502
30520
|
* - packageId: The package Id (UTF8-BASE64-URL-encoded)
|
|
30503
30521
|
* - aasIds?: A list of Asset Administration Shells' unique ids
|
|
30504
30522
|
* - file: The file to upload
|
|
30505
|
-
* - fileName: The name of the file
|
|
30523
|
+
* - fileName: The name of the file, sent as filename of the file part and as `fileName` field
|
|
30506
30524
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
30507
30525
|
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
30508
30526
|
*
|
|
@@ -30519,7 +30537,7 @@ var AasxFileClient = class AasxFileClient {
|
|
|
30519
30537
|
const response = await apiInstance.putAASXByPackageIdRaw({
|
|
30520
30538
|
packageId: encodedPackageId,
|
|
30521
30539
|
aasIds,
|
|
30522
|
-
file,
|
|
30540
|
+
file: withFileName(file, fileName),
|
|
30523
30541
|
fileName
|
|
30524
30542
|
});
|
|
30525
30543
|
return {
|
|
@@ -32607,7 +32625,7 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32607
32625
|
* - configuration: The http request options
|
|
32608
32626
|
* - submodelIdentifier: The Submodel's unique id
|
|
32609
32627
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
32610
|
-
* - fileName?: Name of the uploaded file
|
|
32628
|
+
* - fileName?: Name of the uploaded file, sent as filename of the file part and as `fileName` field
|
|
32611
32629
|
* - file?: File content
|
|
32612
32630
|
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
32613
32631
|
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
@@ -32626,7 +32644,7 @@ var SubmodelRepositoryClient = class SubmodelRepositoryClient {
|
|
|
32626
32644
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
32627
32645
|
idShortPath,
|
|
32628
32646
|
fileName,
|
|
32629
|
-
file
|
|
32647
|
+
file: file && withFileName(file, fileName)
|
|
32630
32648
|
});
|
|
32631
32649
|
return {
|
|
32632
32650
|
success: true,
|
|
@@ -36251,7 +36269,7 @@ function parseBlob(data) {
|
|
|
36251
36269
|
return new Blob$1(data.extensions?.extension ? data.extensions.extension.map(parseExtension) : void 0, data.category || void 0, data.idShort || void 0, data.displayName?.langStringNameType ? data.displayName.langStringNameType.map(parseLangStringNameType) : void 0, data.description?.langStringTextType ? data.description.langStringTextType.map(parseLangStringTextType) : void 0, data.semanticId ? parseReference(data.semanticId) : void 0, data.supplementalSemanticIds?.reference ? data.supplementalSemanticIds.reference.map(parseReference) : void 0, data.qualifiers?.qualifier ? data.qualifiers.qualifier.map(parseQualifier) : void 0, data.embeddedDataSpecifications?.embeddedDataSpecification ? data.embeddedDataSpecifications.embeddedDataSpecification.map(parseEmbeddedDataSpecification) : void 0, data.value || void 0, data.contentType);
|
|
36252
36270
|
}
|
|
36253
36271
|
function parseFile(data) {
|
|
36254
|
-
return new File(data.extensions?.extension ? data.extensions.extension.map(parseExtension) : void 0, data.category || void 0, data.idShort || void 0, data.displayName?.langStringNameType ? data.displayName.langStringNameType.map(parseLangStringNameType) : void 0, data.description?.langStringTextType ? data.description.langStringTextType.map(parseLangStringTextType) : void 0, data.semanticId ? parseReference(data.semanticId) : void 0, data.supplementalSemanticIds?.reference ? data.supplementalSemanticIds.reference.map(parseReference) : void 0, data.qualifiers?.qualifier ? data.qualifiers.qualifier.map(parseQualifier) : void 0, data.embeddedDataSpecifications?.embeddedDataSpecification ? data.embeddedDataSpecifications.embeddedDataSpecification.map(parseEmbeddedDataSpecification) : void 0, data.value || void 0, data.contentType);
|
|
36272
|
+
return new File$1(data.extensions?.extension ? data.extensions.extension.map(parseExtension) : void 0, data.category || void 0, data.idShort || void 0, data.displayName?.langStringNameType ? data.displayName.langStringNameType.map(parseLangStringNameType) : void 0, data.description?.langStringTextType ? data.description.langStringTextType.map(parseLangStringTextType) : void 0, data.semanticId ? parseReference(data.semanticId) : void 0, data.supplementalSemanticIds?.reference ? data.supplementalSemanticIds.reference.map(parseReference) : void 0, data.qualifiers?.qualifier ? data.qualifiers.qualifier.map(parseQualifier) : void 0, data.embeddedDataSpecifications?.embeddedDataSpecification ? data.embeddedDataSpecifications.embeddedDataSpecification.map(parseEmbeddedDataSpecification) : void 0, data.value || void 0, data.contentType);
|
|
36255
36273
|
}
|
|
36256
36274
|
function parseEntity(data) {
|
|
36257
36275
|
const entityType = data.entityType ? entityTypeFromJsonable(data.entityType).value ?? data.entityType : void 0;
|