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