@golpoai/sdk 1.0.1 → 1.0.3

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/dist/index.cjs CHANGED
@@ -256,7 +256,8 @@ var Golpo = class {
256
256
  fields.push(["user_videos_description", value]);
257
257
  }
258
258
  if (userAudioInVideo) {
259
- fields.push(["user_audio_in_video", userAudioInVideo]);
259
+ const value = Array.isArray(userAudioInVideo) ? JSON.stringify(userAudioInVideo) : userAudioInVideo;
260
+ fields.push(["user_audio_in_video", value]);
260
261
  } else if (userVideos) {
261
262
  fields.push(["user_audio_in_video", "[]"]);
262
263
  }
@@ -838,19 +839,12 @@ var Golpo = class {
838
839
  }
839
840
  if (localFiles.length > 0) {
840
841
  const limit = (0, import_p_limit.default)(concurrency);
841
- await Promise.all(
842
- localFiles.map(
843
- (filePath) => limit(async () => {
844
- const absPath = (0, import_path.resolve)(filePath);
845
- const fileName = (0, import_path.basename)(absPath);
846
- const mimeType = (0, import_mime_types.lookup)(absPath) || "application/octet-stream";
847
- formData.append("uploads", (0, import_fs.createReadStream)(absPath), {
848
- filename: fileName,
849
- contentType: mimeType
850
- });
851
- })
852
- )
842
+ const uploadedUrls = await Promise.all(
843
+ localFiles.map((filePath) => limit(() => this.uploadFileAndGetUrl(filePath)))
853
844
  );
845
+ uploadedUrls.forEach((url) => {
846
+ formData.append("upload_urls", url);
847
+ });
854
848
  }
855
849
  }
856
850
  return formData;
package/dist/index.d.cts CHANGED
@@ -44,7 +44,7 @@ interface CreateVideoOptions {
44
44
  userImagesDescriptions?: string | string[];
45
45
  userVideos?: string | string[];
46
46
  userVideosDescription?: string | string[];
47
- userAudioInVideo?: string;
47
+ userAudioInVideo?: number[] | string;
48
48
  use2Style?: boolean;
49
49
  imageStyle?: 'neon' | 'whiteboard' | 'modern_minimal' | 'playful' | 'technical' | 'editorial';
50
50
  inputImages?: string | string[];
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ interface CreateVideoOptions {
44
44
  userImagesDescriptions?: string | string[];
45
45
  userVideos?: string | string[];
46
46
  userVideosDescription?: string | string[];
47
- userAudioInVideo?: string;
47
+ userAudioInVideo?: number[] | string;
48
48
  use2Style?: boolean;
49
49
  imageStyle?: 'neon' | 'whiteboard' | 'modern_minimal' | 'playful' | 'technical' | 'editorial';
50
50
  inputImages?: string | string[];
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/Golpo.ts
2
2
  import axios from "axios";
3
- import { createReadStream, promises as fs } from "fs";
3
+ import { promises as fs } from "fs";
4
4
  import { basename, resolve } from "path";
5
5
  import { lookup as mimeLookup } from "mime-types";
6
6
  import pLimit from "p-limit";
@@ -219,7 +219,8 @@ var Golpo = class {
219
219
  fields.push(["user_videos_description", value]);
220
220
  }
221
221
  if (userAudioInVideo) {
222
- fields.push(["user_audio_in_video", userAudioInVideo]);
222
+ const value = Array.isArray(userAudioInVideo) ? JSON.stringify(userAudioInVideo) : userAudioInVideo;
223
+ fields.push(["user_audio_in_video", value]);
223
224
  } else if (userVideos) {
224
225
  fields.push(["user_audio_in_video", "[]"]);
225
226
  }
@@ -801,19 +802,12 @@ var Golpo = class {
801
802
  }
802
803
  if (localFiles.length > 0) {
803
804
  const limit = pLimit(concurrency);
804
- await Promise.all(
805
- localFiles.map(
806
- (filePath) => limit(async () => {
807
- const absPath = resolve(filePath);
808
- const fileName = basename(absPath);
809
- const mimeType = mimeLookup(absPath) || "application/octet-stream";
810
- formData.append("uploads", createReadStream(absPath), {
811
- filename: fileName,
812
- contentType: mimeType
813
- });
814
- })
815
- )
805
+ const uploadedUrls = await Promise.all(
806
+ localFiles.map((filePath) => limit(() => this.uploadFileAndGetUrl(filePath)))
816
807
  );
808
+ uploadedUrls.forEach((url) => {
809
+ formData.append("upload_urls", url);
810
+ });
817
811
  }
818
812
  }
819
813
  return formData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golpoai/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {