vidspotai-shared 1.0.32 → 1.0.34

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 (41) hide show
  1. package/lib/globals/index.d.ts +1 -0
  2. package/lib/globals/index.d.ts.map +1 -1
  3. package/lib/globals/index.js +1 -0
  4. package/lib/models/user.model.d.ts +2 -0
  5. package/lib/models/user.model.d.ts.map +1 -1
  6. package/lib/models/video.model.d.ts +9 -0
  7. package/lib/models/video.model.d.ts.map +1 -1
  8. package/lib/services/aiGen/aiGenFactory.service.d.ts.map +1 -1
  9. package/lib/services/aiGen/aiGenFactory.service.js +36 -12
  10. package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
  11. package/lib/services/aiGen/providers/bytedance/bytedance.service.js +22 -2
  12. package/lib/services/aiGen/providers/google/google.service.js +1 -1
  13. package/lib/services/aiGen/providers/kling/kling.service.d.ts +7 -2
  14. package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
  15. package/lib/services/aiGen/providers/kling/kling.service.js +126 -10
  16. package/lib/services/aiGen/providers/kling/types.d.ts +13 -0
  17. package/lib/services/aiGen/providers/kling/types.d.ts.map +1 -1
  18. package/lib/services/aiGen/providers/runway/runway.service.d.ts.map +1 -1
  19. package/lib/services/aiGen/providers/runway/runway.service.js +16 -4
  20. package/lib/services/aiGen/providers/types.d.ts +6 -0
  21. package/lib/services/aiGen/providers/types.d.ts.map +1 -1
  22. package/lib/services/credit.service.d.ts +1 -0
  23. package/lib/services/credit.service.d.ts.map +1 -1
  24. package/lib/services/credit.service.js +17 -0
  25. package/lib/services/index.d.ts +1 -0
  26. package/lib/services/index.d.ts.map +1 -1
  27. package/lib/services/index.js +1 -0
  28. package/lib/services/tts/providers/elevenlabs.service.d.ts +1 -0
  29. package/lib/services/tts/providers/elevenlabs.service.d.ts.map +1 -1
  30. package/lib/services/tts/providers/elevenlabs.service.js +4 -2
  31. package/lib/utils/helpers.js +2 -2
  32. package/lib/utils/index.d.ts +1 -0
  33. package/lib/utils/index.d.ts.map +1 -1
  34. package/lib/utils/index.js +1 -0
  35. package/lib/utils/logger.d.ts +2 -1
  36. package/lib/utils/logger.d.ts.map +1 -1
  37. package/lib/utils/logger.js +2 -0
  38. package/package.json +1 -1
  39. package/lib/globals/aiModels.d.ts +0 -63
  40. package/lib/globals/aiModels.d.ts.map +0 -1
  41. package/lib/globals/aiModels.js +0 -529
@@ -11,9 +11,11 @@ class ElevenLabsService extends types_1.BaseTtsProviderService {
11
11
  constructor() {
12
12
  super();
13
13
  this.baseUrl = "https://api.elevenlabs.io/v1";
14
- if (!process.env.ELEVENLABS_API_KEY) {
14
+ const raw = process.env.ELEVENLABS_API_KEY?.trim();
15
+ if (!raw) {
15
16
  throw new Error("Missing ELEVENLABS_API_KEY in environment variables");
16
17
  }
18
+ this.apiKey = raw;
17
19
  }
18
20
  async generate(params) {
19
21
  const voiceId = params.voiceId ?? elevenlabs_1.elevenlabsConfig.defaultVoiceId;
@@ -27,7 +29,7 @@ class ElevenLabsService extends types_1.BaseTtsProviderService {
27
29
  },
28
30
  }, {
29
31
  headers: {
30
- "xi-api-key": process.env.ELEVENLABS_API_KEY,
32
+ "xi-api-key": this.apiKey,
31
33
  "Content-Type": "application/json",
32
34
  Accept: "audio/mpeg",
33
35
  },
@@ -49,8 +49,8 @@ const getPriceIdByType = (type, freq = types_1.ERENEWAL_FREQUENCY.MONTHLY) => {
49
49
  };
50
50
  exports.getPriceIdByType = getPriceIdByType;
51
51
  const getCreditsFromCost = (cost) => {
52
- const margin = 0.2;
53
- const costPerCredit = 0.1;
52
+ const margin = 0.2; // 20% margin
53
+ const costPerCredit = 0.1; // multiple
54
54
  const minCredits = 10;
55
55
  if (cost <= 0)
56
56
  return 0;
@@ -1,3 +1,4 @@
1
1
  export * from "./helpers";
2
2
  export * from "./logger";
3
+ export * from "./ttsUtils";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./helpers"), exports);
18
18
  __exportStar(require("./logger"), exports);
19
+ __exportStar(require("./ttsUtils"), exports);
@@ -1,6 +1,7 @@
1
- import { Logger } from "winston";
1
+ import winston, { Logger } from "winston";
2
2
  /**
3
3
  * Logger factory
4
4
  */
5
5
  export declare function createLogger(serviceName: string): Logger;
6
+ export declare const logger: winston.Logger;
6
7
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AA0B1C;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsExD"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AA0B1C;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsExD;AAED,eAAO,MAAM,MAAM,gBAAyB,CAAC"}
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = void 0;
6
7
  exports.createLogger = createLogger;
7
8
  const winston_1 = __importDefault(require("winston"));
8
9
  const winston_slack_webhook_transport_1 = __importDefault(require("winston-slack-webhook-transport"));
@@ -83,3 +84,4 @@ function createLogger(serviceName) {
83
84
  exitOnError: false,
84
85
  });
85
86
  }
87
+ exports.logger = createLogger("shared");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {
@@ -1,63 +0,0 @@
1
- export declare enum EVideoGenModels {
2
- GOOGLE_VEO_3_1_PREVIEW = "google-veo-3.1-preview",
3
- GOOGLE_VEO_3_1__FAST_PREVIEW = "google-veo-3.1-fast-preview",
4
- GOOGLE_VEO_3 = "google-veo-3",
5
- GOOGLE_VEO_3_FAST = "google-veo-3-fast",
6
- GOOGLE_VEO_2 = "google-veo-2",
7
- RUNWAY_GEN4_TURBO = "runway-gen4-turbo",
8
- RUNWAY_GEN4_ALEPH = "runway-gen4-aleph",
9
- KLING_V1 = "kling-v1",
10
- KLING_V1_6 = "kling-v1.6",
11
- KLING_V2_MASTER = "kling-v2-master",
12
- KLING_V2_1_MASTER = "kling-v2.1-master",
13
- MINIMAX_HAILUO_02 = "minimax-hailuo-02",
14
- T2V_01_DIRECTOR = "T2V-01-Director",
15
- T2V_01 = "T2V-01",
16
- AZURE_SORA = "azure-sora",
17
- ALIBABA_WAN_2_5 = "alibaba-wan-2.5",
18
- ALIBABA_WAN_2_2 = "alibaba-wan-2.2",
19
- OPENAI_SORA_2 = "openai-sora-2",
20
- OPENAI_SORA_2_PRO = "openai-sora-2-pro"
21
- }
22
- export declare const EImageGenModels: {
23
- readonly OPENAI_DALLE_3: "openai-dalle-3";
24
- readonly STABILITY_STABLE_DIFFUSION: "stability-stable-diffusion";
25
- readonly MIDJOURNEY_V6: "midjourney-v6";
26
- readonly FLUX_1_1: "flux-1.1";
27
- readonly IDEOGRAM_1_0: "ideogram-1.0";
28
- };
29
- export declare enum ETextGenModels {
30
- OPENAI_GPT_4O_MINI = "openai-gpt-4o-mini",
31
- OPENAI_GPT_5_MINI = "openai-gpt-5-mini"
32
- }
33
- export type TAiGenModel = EVideoGenModels | ETextGenModels;
34
- type GenerationType = "text-to-video" | "image-to-video" | "video-to-video" | "text-to-text" | "image-to-text";
35
- interface ISchemaField {
36
- required?: boolean;
37
- allowedValues?: string[] | number[];
38
- default?: string | number;
39
- }
40
- interface ICostTable {
41
- [key: string]: {
42
- [key: number]: number;
43
- };
44
- }
45
- interface IModelSchema {
46
- modelId: string;
47
- type: GenerationType[];
48
- fields: Record<string, ISchemaField>;
49
- resolutionRules?: Record<string, string[]>;
50
- durationRules?: Record<number, string[]>;
51
- concurrentRequests?: number;
52
- requestPerMin?: number;
53
- requestPerDay?: number;
54
- cost?: {
55
- perSecond?: number;
56
- per1KTokens?: number;
57
- table?: ICostTable;
58
- fixed?: number;
59
- };
60
- }
61
- export declare const aiModelConfigs: Record<TAiGenModel, IModelSchema>;
62
- export {};
63
- //# sourceMappingURL=aiModels.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aiModels.d.ts","sourceRoot":"","sources":["../../src/globals/aiModels.ts"],"names":[],"mappings":"AAwBA,oBAAY,eAAe;IACzB,sBAAsB,2BAA2B;IACjD,4BAA4B,gCAAgC;IAC5D,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IACnC,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,eAAe,oBAAoB;IACnC,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;CACxC;AAaD,eAAO,M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