@hautechai/sdk 2.21.8 → 2.21.10

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/README.md CHANGED
@@ -61,6 +61,12 @@ const sdk = createSDK({ authToken: () => accountToken }); // you should call the
61
61
 
62
62
  Docs about how to use the SDK are available [here](https://docs.hautech.ai/)
63
63
 
64
+ ### Uploading files
65
+
66
+ - In browsers, prefer passing a `File` object to methods like `sdk.images.createFromFile` and `sdk.videos.createFromFile`. The `File.name` will be included in the multipart upload automatically.
67
+ - If you pass a `Blob` in the browser, some environments may set the filename to a default value (e.g., `"blob"`). To control the filename when using a `Blob`, wrap it in an object with explicit metadata on server-side, or construct a `File` from the `Blob`.
68
+ - In Node.js, when you pass a string path (e.g., `/path/to/image.png`), the SDK sets the multipart filename to the basename of the path (e.g., `image.png`). You can also pass an object with `{ stream, filename, contentType }` to control metadata explicitly.
69
+
64
70
  ## Development
65
71
 
66
72
  ### Prerequisites
package/dist/index.d.mts CHANGED
@@ -7600,6 +7600,10 @@ interface ImageEntity {
7600
7600
  createdAt: string;
7601
7601
  updatedAt: string;
7602
7602
  format: string;
7603
+ /** @nullable */
7604
+ originalFilenameBase?: string | null;
7605
+ /** @nullable */
7606
+ originalFilenameExt?: string | null;
7603
7607
  width: number;
7604
7608
  height: number;
7605
7609
  url: string;
package/dist/index.d.ts CHANGED
@@ -7600,6 +7600,10 @@ interface ImageEntity {
7600
7600
  createdAt: string;
7601
7601
  updatedAt: string;
7602
7602
  format: string;
7603
+ /** @nullable */
7604
+ originalFilenameBase?: string | null;
7605
+ /** @nullable */
7606
+ originalFilenameExt?: string | null;
7603
7607
  width: number;
7604
7608
  height: number;
7605
7609
  url: string;
package/dist/index.js CHANGED
@@ -10853,7 +10853,10 @@ var useVideosApi = () => {
10853
10853
  if (typeof file === "string") {
10854
10854
  if (isBrowser) throw new Error("Cannot use file path in browser");
10855
10855
  const fs = require("fs");
10856
- formData.append("file", fs.createReadStream(file));
10856
+ const path = require("path");
10857
+ formData.append("file", fs.createReadStream(file), {
10858
+ filename: path.basename(file)
10859
+ });
10857
10860
  } else if (isBrowser && file instanceof Blob) {
10858
10861
  formData.append("file", file);
10859
10862
  } else if (!(file instanceof Blob) && typeof file === "object" && "stream" in file) {
@@ -11281,7 +11284,10 @@ var useImagesApi = () => {
11281
11284
  if (typeof file === "string") {
11282
11285
  if (isBrowser) throw new Error("Cannot use file path in browser");
11283
11286
  const fs = require("fs");
11284
- formData.append("file", fs.createReadStream(file));
11287
+ const path = require("path");
11288
+ formData.append("file", fs.createReadStream(file), {
11289
+ filename: path.basename(file)
11290
+ });
11285
11291
  } else if (isBrowser && file instanceof Blob) {
11286
11292
  formData.append("file", file);
11287
11293
  } else if (typeof file === "object" && "filename" in file) {