vidspotai-shared 1.0.58 → 1.0.60

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.
@@ -19,4 +19,22 @@ export declare const DEFAULT_ELEVENLABS_VOICE_ID = "EXAVITQu4vr4xnSDxMaL";
19
19
  * Reference: https://help.elevenlabs.io/hc/en-us/articles/13313366263441
20
20
  */
21
21
  export declare const LANG_TO_ELEVENLABS_CODE: Record<string, string>;
22
+ /**
23
+ * ElevenLabs `eleven_turbo_v2_5` supported languages (32 total, per docs:
24
+ * https://elevenlabs.io/docs/models#supported-languages). Used for the
25
+ * preview-audio path: turbo_v2_5 is ~3–5× faster than `eleven_v3` and
26
+ * preview quality differences are imperceptible at short sample lengths.
27
+ *
28
+ * Languages added in v3 only (e.g. Hebrew `he`, Thai `th`) fall back to
29
+ * `eleven_v3` for preview to avoid an unsupported-language error.
30
+ *
31
+ * Values are the mapped ElevenLabs `language_code` (post-`mapLanguageCode`).
32
+ */
33
+ export declare const ELEVEN_TURBO_V2_5_LANGS: ReadonlySet<string>;
34
+ /**
35
+ * Picks the fastest ElevenLabs model that supports the given language.
36
+ * @param locale Standard locale string (e.g. "en", "fr-FR"). When undefined
37
+ * or unknown, returns v3 — the only model with auto-detect across all langs.
38
+ */
39
+ export declare function getElevenLabsPreviewModelId(locale: string | undefined): string;
22
40
  //# sourceMappingURL=voices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"voices.d.ts","sourceRoot":"","sources":["../../../src/globals/ttsModels/voices.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,EAuFxC,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuC1D,CAAC"}
1
+ {"version":3,"file":"voices.d.ts","sourceRoot":"","sources":["../../../src/globals/ttsModels/voices.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,EAuFxC,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuC1D,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAKtD,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAI9E"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LANG_TO_ELEVENLABS_CODE = exports.DEFAULT_ELEVENLABS_VOICE_ID = exports.ELEVENLABS_VOICES = void 0;
3
+ exports.ELEVEN_TURBO_V2_5_LANGS = exports.LANG_TO_ELEVENLABS_CODE = exports.DEFAULT_ELEVENLABS_VOICE_ID = exports.ELEVENLABS_VOICES = void 0;
4
+ exports.getElevenLabsPreviewModelId = getElevenLabsPreviewModelId;
4
5
  /**
5
6
  * Curated list of ElevenLabs voices compatible with eleven_multilingual_v3.
6
7
  * Any voice can speak any supported language via the language_code parameter.
@@ -140,3 +141,31 @@ exports.LANG_TO_ELEVENLABS_CODE = {
140
141
  uk: "uk",
141
142
  vi: "vi",
142
143
  };
144
+ /**
145
+ * ElevenLabs `eleven_turbo_v2_5` supported languages (32 total, per docs:
146
+ * https://elevenlabs.io/docs/models#supported-languages). Used for the
147
+ * preview-audio path: turbo_v2_5 is ~3–5× faster than `eleven_v3` and
148
+ * preview quality differences are imperceptible at short sample lengths.
149
+ *
150
+ * Languages added in v3 only (e.g. Hebrew `he`, Thai `th`) fall back to
151
+ * `eleven_v3` for preview to avoid an unsupported-language error.
152
+ *
153
+ * Values are the mapped ElevenLabs `language_code` (post-`mapLanguageCode`).
154
+ */
155
+ exports.ELEVEN_TURBO_V2_5_LANGS = new Set([
156
+ "en", "ja", "zh", "de", "hi", "fr", "ko", "pt", "it", "es",
157
+ "id", "nl", "tr", "fil", "pl", "sv", "bg", "ro", "ar", "cs",
158
+ "el", "fi", "hr", "ms", "sk", "da", "ta", "uk", "ru", "hu",
159
+ "no", "vi",
160
+ ]);
161
+ /**
162
+ * Picks the fastest ElevenLabs model that supports the given language.
163
+ * @param locale Standard locale string (e.g. "en", "fr-FR"). When undefined
164
+ * or unknown, returns v3 — the only model with auto-detect across all langs.
165
+ */
166
+ function getElevenLabsPreviewModelId(locale) {
167
+ if (!locale)
168
+ return "eleven_v3";
169
+ const mapped = exports.LANG_TO_ELEVENLABS_CODE[locale] ?? locale.split("-")[0] ?? locale;
170
+ return exports.ELEVEN_TURBO_V2_5_LANGS.has(mapped) ? "eleven_turbo_v2_5" : "eleven_v3";
171
+ }
@@ -53,6 +53,10 @@ export interface IVideoJobModel {
53
53
  ttsVoiceId?: string;
54
54
  ttsLanguageCode?: string;
55
55
  generatedAudioUrl?: string;
56
+ /** True when inputAudioUrl is the preview-audio URL and it covers the entire
57
+ * ttsText (short text, single chunk). Tells the worker to reuse inputAudioUrl
58
+ * directly and skip TTS regeneration. */
59
+ ttsPreviewIsComplete?: boolean;
56
60
  audioDurationSeconds?: number;
57
61
  isSample?: boolean;
58
62
  createdAt: FieldValue;
@@ -1 +1 @@
1
- {"version":3,"file":"video.model.d.ts","sourceRoot":"","sources":["../../src/models/video.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CAOpB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC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C;IAC1B,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,UAAU,CAAC;KACxB,CAAA;IAGD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,WAAW,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;8CAE0C;IAC1C,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAI9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"minimax.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/minimax/minimax.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,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B,GAClB,EAAE,iBAAiB,GAAG,MAAM;CAW9B"}
@@ -20,39 +20,61 @@ const logger_1 = require("../../../../utils/logger");
20
20
  // Marker prefix on errorMessage so sceneMonitor's classifier can suppress Slack
21
21
  // alerts for user-input failures (image too small, unsupported format, etc.).
22
22
  exports.MINIMAX_USER_INPUT_ERROR_PREFIX = "user_input_error: ";
23
- function minimaxStatusToUserMessage(code, msg) {
23
+ function classifyMinimaxError(code, msg) {
24
24
  const lower = (msg || "").toLowerCase();
25
25
  // Input-validation errors — user can fix these by changing their input.
26
26
  // Detected by message text because Minimax does not give a stable code for these.
27
27
  if (lower.includes("first_frame_image") || lower.includes("last_frame_image") || lower.includes("subject_reference")) {
28
28
  if (lower.includes("minimum pixel") || lower.includes("short side")) {
29
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your input image is too small. Please upload an image at least 300px on the short side.`;
29
+ return { message: "Your input image is too small. Please upload an image at least 300px on the short side.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
30
30
  }
31
31
  if (lower.includes("aspect ratio") || lower.includes("ratio")) {
32
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your input image's aspect ratio is not supported. Please use a more standard ratio (e.g. 16:9, 9:16, 1:1).`;
32
+ return { message: "Your input image's aspect ratio is not supported. Please use a more standard ratio (e.g. 16:9, 9:16, 1:1).", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
33
33
  }
34
34
  if (lower.includes("format") || lower.includes("type")) {
35
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your input image format is not supported. Please use JPEG or PNG.`;
35
+ return { message: "Your input image format is not supported. Please use JPEG or PNG.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
36
36
  }
37
37
  if (lower.includes("size") || lower.includes("too large")) {
38
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your input image is too large. Please upload a smaller image.`;
38
+ return { message: "Your input image is too large. Please upload a smaller image.", code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
39
+ }
40
+ return { message: `Your input image was rejected by the provider: ${msg}`, code: errors_1.USER_FACING_ERROR_CODES.INPUT_IMAGE_REJECTED, isUserInput: true };
41
+ }
42
+ // Code 2013 = "invalid params". Sub-classify by message text — Minimax reuses
43
+ // this single code for prompt-too-long, prompt-empty, and other shape errors.
44
+ if (code === 2013) {
45
+ if (lower.includes("prompt is too long") || lower.includes("prompt too long") || (lower.includes("prompt") && lower.includes("too long"))) {
46
+ return { message: "Your prompt is too long for this model. Please shorten it and try again.", code: errors_1.USER_FACING_ERROR_CODES.PROMPT_TOO_LONG, isUserInput: true };
47
+ }
48
+ if (lower.includes("prompt")) {
49
+ return { message: `Your prompt was rejected by the provider: ${msg}. Please adjust it and try again.`, code: errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID, isUserInput: true };
39
50
  }
40
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your input image was rejected by the provider: ${msg}`;
51
+ return { message: `Invalid request parameters: ${msg}. Please adjust your input and try again.`, code: errors_1.USER_FACING_ERROR_CODES.PROMPT_INVALID, isUserInput: true };
41
52
  }
42
53
  switch (code) {
43
54
  case 1026:
44
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your request was declined because the prompt or input image contains content that violates the content policy. Please modify your prompt or use a different image and try again.`;
55
+ return { message: "Your request was declined because the prompt or input image contains content that violates the content policy. Please modify your prompt or use a different image and try again.", code: errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION, isUserInput: true };
45
56
  case 1027:
46
- return `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}Your request was declined because the generated content was flagged for sensitive material. Please adjust your prompt and try again.`;
57
+ return { message: "Your request was declined because the generated content was flagged for sensitive material. Please adjust your prompt and try again.", code: errors_1.USER_FACING_ERROR_CODES.CONTENT_POLICY_VIOLATION, isUserInput: true };
47
58
  case 1002:
48
- return "The request was rejected due to a rate limit or quota issue. Please try again in a moment.";
59
+ return { message: "The request was rejected due to a rate limit or quota issue. Please try again in a moment.", code: errors_1.USER_FACING_ERROR_CODES.VIDEO_PROVIDER_RATE_LIMITED, isUserInput: false };
49
60
  case 1004:
50
- return "Authorization failed for the video generation service. Please contact support.";
61
+ return { message: "Authorization failed for the video generation service. Please contact support.", isUserInput: false };
51
62
  default:
52
- // Unknown code — return the raw message so ops can see it but strip internal codes
53
- return msg || `Generation failed (code ${code})`;
63
+ return { message: msg || `Generation failed (code ${code})`, isUserInput: false };
54
64
  }
55
65
  }
66
+ /**
67
+ * Back-compat wrapper for callers that only need the string form (used by
68
+ * checkVideoStatus when persisting scene.errorMessage on async failures).
69
+ * Preserves the existing MINIMAX_USER_INPUT_ERROR_PREFIX marker so the
70
+ * sceneMonitor's classifier still suppresses Slack noise for user-input errors.
71
+ */
72
+ function minimaxStatusToUserMessage(code, msg) {
73
+ const cls = classifyMinimaxError(code, msg);
74
+ return cls.isUserInput
75
+ ? `${exports.MINIMAX_USER_INPUT_ERROR_PREFIX}${cls.message}`
76
+ : cls.message;
77
+ }
56
78
  // Transient axios/network failures that warrant a retry.
57
79
  const MINIMAX_TRANSIENT_NETWORK_CODES = new Set([
58
80
  "ECONNRESET",
@@ -163,13 +185,14 @@ class MinimaxService extends baseAiGenProvider_service_1.BaseAiGenProviderServic
163
185
  // half-triggered scene with no task handle.
164
186
  const baseStatus = response.base_resp?.status_code ?? 0;
165
187
  if (baseStatus !== 0 || !response.task_id) {
166
- const userMessage = minimaxStatusToUserMessage(baseStatus, response.base_resp?.status_msg ?? "");
167
- const isUserInput = userMessage.startsWith(exports.MINIMAX_USER_INPUT_ERROR_PREFIX);
168
- const cleaned = userMessage.replace(exports.MINIMAX_USER_INPUT_ERROR_PREFIX, "");
169
- if (isUserInput) {
170
- throw new errors_1.UserFacingError(cleaned);
188
+ const cls = classifyMinimaxError(baseStatus, response.base_resp?.status_msg ?? "");
189
+ if (cls.isUserInput) {
190
+ // UserFacingError logged as warn (no Slack page) AND serialized
191
+ // with `code` so the frontend can show a translated message.
192
+ throw new errors_1.UserFacingError(cls.message, cls.code);
171
193
  }
172
- throw new Error(`Minimax video_generation returned no task_id (code ${baseStatus}): ${cleaned}`);
194
+ // Provider-side failure the user cannot fix Slack alert + raw debug context.
195
+ throw new Error(`Minimax video_generation returned no task_id (code ${baseStatus}): ${cls.message}`);
173
196
  }
174
197
  return { task: response.task_id, status: types_1.EVideoSceneStatus.TRIGGERED };
175
198
  }
@@ -1 +1 @@
1
- {"version":3,"file":"elevenlabs.service.d.ts","sourceRoot":"","sources":["../../../../src/services/tts/providers/elevenlabs.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBzF,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;IAW1B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA4DrD;;;;;OAKG;YACW,gBAAgB;IAuC9B,SAAS,IAAI,eAAe,EAAE;IAI9B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGpD"}
1
+ {"version":3,"file":"elevenlabs.service.d.ts","sourceRoot":"","sources":["../../../../src/services/tts/providers/elevenlabs.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAiBzF,qBAAa,iBAAkB,SAAQ,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;;IAW1B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA6DrD;;;;;OAKG;YACW,gBAAgB;IAuC9B,SAAS,IAAI,eAAe,EAAE;IAI9B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGpD"}
@@ -38,9 +38,10 @@ class ElevenLabsService extends types_1.BaseTtsProviderService {
38
38
  const languageCode = params.languageCode
39
39
  ? this.mapLanguageCode(params.languageCode)
40
40
  : undefined;
41
+ const modelId = params.modelIdOverride ?? elevenlabs_1.elevenlabsConfig.modelId;
41
42
  const buildBody = (lang) => ({
42
43
  text: params.text,
43
- model_id: elevenlabs_1.elevenlabsConfig.modelId,
44
+ model_id: modelId,
44
45
  language_code: lang,
45
46
  voice_settings: {
46
47
  stability: 0.5,
@@ -81,7 +82,7 @@ class ElevenLabsService extends types_1.BaseTtsProviderService {
81
82
  extension: "mp3",
82
83
  };
83
84
  }
84
- throw new Error(`ElevenLabs TTS ${err.response.status}: ${detail} [voiceId=${voiceId}, languageCode=${languageCode ?? "none"}, textLen=${params.text?.length ?? 0}]`);
85
+ throw new Error(`ElevenLabs TTS ${err.response.status}: ${detail} [voiceId=${voiceId}, languageCode=${languageCode ?? "none"}, modelId=${modelId}, textLen=${params.text?.length ?? 0}]`);
85
86
  }
86
87
  throw err;
87
88
  }
@@ -2,6 +2,12 @@ export interface TtsParams {
2
2
  text: string;
3
3
  voiceId?: string;
4
4
  languageCode?: string;
5
+ /**
6
+ * Optional provider-specific model override (e.g. ElevenLabs "eleven_turbo_v2_5"
7
+ * for preview to reduce latency). When undefined, providers use their default.
8
+ * Providers that don't support overrides ignore this field.
9
+ */
10
+ modelIdOverride?: string;
5
11
  }
6
12
  export interface TtsResult {
7
13
  audioBuffer: Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/tts/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,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iG;IACjG,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,8BAAsB,sBAAsB;IAC1C,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAExD;;;OAGG;IACH,QAAQ,CAAC,SAAS,IAAI,eAAe,EAAE;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAC7D"}
@@ -26,6 +26,10 @@ export declare const USER_FACING_ERROR_CODES: {
26
26
  readonly VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT";
27
27
  readonly TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT";
28
28
  readonly TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE";
29
+ readonly PROMPT_TOO_LONG: "PROMPT_TOO_LONG";
30
+ readonly PROMPT_INVALID: "PROMPT_INVALID";
31
+ readonly INPUT_IMAGE_REJECTED: "INPUT_IMAGE_REJECTED";
32
+ readonly CONTENT_POLICY_VIOLATION: "CONTENT_POLICY_VIOLATION";
29
33
  };
30
34
  export type UserFacingErrorCode = keyof typeof USER_FACING_ERROR_CODES;
31
35
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAM1C,qEAAqE;IACrE,MAAM,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAG7C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;CAM1B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,iBAAiB,QAAQ;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAM1C,qEAAqE;IACrE,MAAM,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAG7C;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;CAU1B,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
@@ -32,4 +32,8 @@ exports.USER_FACING_ERROR_CODES = {
32
32
  VIDEO_PROVIDER_TIMEOUT: "VIDEO_PROVIDER_TIMEOUT",
33
33
  TTS_PROVIDER_TIMEOUT: "TTS_PROVIDER_TIMEOUT",
34
34
  TTS_PROVIDER_UNAVAILABLE: "TTS_PROVIDER_UNAVAILABLE",
35
+ PROMPT_TOO_LONG: "PROMPT_TOO_LONG",
36
+ PROMPT_INVALID: "PROMPT_INVALID",
37
+ INPUT_IMAGE_REJECTED: "INPUT_IMAGE_REJECTED",
38
+ CONTENT_POLICY_VIOLATION: "CONTENT_POLICY_VIOLATION",
35
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {