@picsart/ai-sdk 6.48.1 → 6.48.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.
Files changed (2) hide show
  1. package/index.js +8 -9
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11878,13 +11878,12 @@ var extractUrl = (result) => {
11878
11878
  if (typeof obj.url === "string") return obj.url;
11879
11879
  if (typeof obj.videoUrl === "string") return obj.videoUrl;
11880
11880
  if (typeof obj.video_url === "string") return obj.video_url;
11881
- if (obj.video && typeof obj.video === "object") {
11882
- const v = obj.video;
11883
- if (typeof v.url === "string") return v.url;
11884
- }
11885
- if (obj.audio && typeof obj.audio === "object") {
11886
- const a = obj.audio;
11887
- if (typeof a.url === "string") return a.url;
11881
+ for (const key of ["video", "audio"]) {
11882
+ const media = Array.isArray(obj[key]) ? obj[key][0] : obj[key];
11883
+ if (media && typeof media === "object") {
11884
+ const m = media;
11885
+ if (typeof m.url === "string") return m.url;
11886
+ }
11888
11887
  }
11889
11888
  if (obj.assets && typeof obj.assets === "object") {
11890
11889
  const a = obj.assets;
@@ -11995,7 +11994,7 @@ var extractText = (result) => {
11995
11994
  }
11996
11995
  return void 0;
11997
11996
  };
11998
- var RESULT_ARRAY_KEYS = ["items", "images", "imageUrls", "urls", "data", "previews"];
11997
+ var RESULT_ARRAY_KEYS = ["items", "images", "imageUrls", "urls", "data", "previews", "audio", "video"];
11999
11998
  var extractAllResults = (result) => {
12000
11999
  if (!result || typeof result !== "object") return void 0;
12001
12000
  const obj = result;
@@ -13836,7 +13835,7 @@ function parseResult(completed, model, contract) {
13836
13835
  }
13837
13836
  const obj = parsed && typeof parsed === "object" ? parsed : void 0;
13838
13837
  let source = parsed;
13839
- for (const key of ["images", "items", "imageUrls", "data", "previews"]) {
13838
+ for (const key of ["images", "items", "imageUrls", "data", "previews", "audio", "video"]) {
13840
13839
  const arr = obj?.[key];
13841
13840
  if (Array.isArray(arr) && arr.length > 0) {
13842
13841
  source = arr[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.48.1",
3
+ "version": "6.48.2",
4
4
  "type": "module",
5
5
  "description": "Type-safe SDK for 100+ AI models — image, video, audio, and text generation with Picsart",
6
6
  "license": "MIT",