@mux/ai 0.21.2 → 0.22.0

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.
@@ -4,6 +4,171 @@ import { createGoogleGenerativeAI } from '@ai-sdk/google';
4
4
  import { createOpenAI } from '@ai-sdk/openai';
5
5
  import { M as MuxAIOptions, I as ImageSubmissionMode, h as TokenUsage, b as ChunkingStrategy, j as VideoEmbeddingsResult, H as Hotspot, t as Shot, i as ToneType, f as StorageAdapter } from './shots-mGJfYGiO.js';
6
6
 
7
+ /**
8
+ * Language Code Conversion Utilities
9
+ *
10
+ * Provides bidirectional mapping between:
11
+ * - ISO 639-1 (2-letter codes) - Used by browsers, BCP-47, most video players
12
+ * - ISO 639-3 (3-letter codes) - Used by various APIs and language processing systems
13
+ *
14
+ * This is essential for interoperability between different systems:
15
+ * - Mux uses ISO 639-1 for track language codes
16
+ * - Browser players expect BCP-47 compliant codes (based on ISO 639-1)
17
+ * - Some APIs require ISO 639-3 (3-letter) codes
18
+ */
19
+ /**
20
+ * Mapping from ISO 639-1 (2-letter) to ISO 639-3 (3-letter) codes.
21
+ * Covers the most common languages used in video translation.
22
+ *
23
+ * Reference: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
24
+ */
25
+ declare const ISO639_1_TO_3: {
26
+ readonly en: "eng";
27
+ readonly es: "spa";
28
+ readonly fr: "fra";
29
+ readonly de: "deu";
30
+ readonly it: "ita";
31
+ readonly pt: "por";
32
+ readonly ru: "rus";
33
+ readonly zh: "zho";
34
+ readonly ja: "jpn";
35
+ readonly ko: "kor";
36
+ readonly ar: "ara";
37
+ readonly hi: "hin";
38
+ readonly nl: "nld";
39
+ readonly pl: "pol";
40
+ readonly sv: "swe";
41
+ readonly da: "dan";
42
+ readonly no: "nor";
43
+ readonly fi: "fin";
44
+ readonly el: "ell";
45
+ readonly cs: "ces";
46
+ readonly hu: "hun";
47
+ readonly ro: "ron";
48
+ readonly bg: "bul";
49
+ readonly hr: "hrv";
50
+ readonly sk: "slk";
51
+ readonly sl: "slv";
52
+ readonly uk: "ukr";
53
+ readonly tr: "tur";
54
+ readonly th: "tha";
55
+ readonly vi: "vie";
56
+ readonly id: "ind";
57
+ readonly ms: "msa";
58
+ readonly tl: "tgl";
59
+ readonly he: "heb";
60
+ readonly fa: "fas";
61
+ readonly bn: "ben";
62
+ readonly ta: "tam";
63
+ readonly te: "tel";
64
+ readonly mr: "mar";
65
+ readonly gu: "guj";
66
+ readonly kn: "kan";
67
+ readonly ml: "mal";
68
+ readonly pa: "pan";
69
+ readonly ur: "urd";
70
+ readonly sw: "swa";
71
+ readonly af: "afr";
72
+ readonly ca: "cat";
73
+ readonly eu: "eus";
74
+ readonly gl: "glg";
75
+ readonly is: "isl";
76
+ readonly et: "est";
77
+ readonly lv: "lav";
78
+ readonly lt: "lit";
79
+ };
80
+ /**
81
+ * Supported ISO 639-1 two-letter language codes.
82
+ * These are the language codes supported for translation workflows.
83
+ */
84
+ type SupportedISO639_1 = keyof typeof ISO639_1_TO_3;
85
+ /**
86
+ * Supported ISO 639-3 three-letter language codes.
87
+ * These are the language codes supported for translation workflows.
88
+ */
89
+ type SupportedISO639_3 = (typeof ISO639_1_TO_3)[SupportedISO639_1];
90
+ /** ISO 639-1 two-letter language code (e.g., "en", "fr", "es") */
91
+ type ISO639_1 = SupportedISO639_1 | (string & {});
92
+ /** ISO 639-3 three-letter language code (e.g., "eng", "fra", "spa") */
93
+ type ISO639_3 = SupportedISO639_3 | (string & {});
94
+ /** Structured language code result containing both formats */
95
+ interface LanguageCodePair {
96
+ /** ISO 639-1 two-letter code (BCP-47 compatible) */
97
+ iso639_1: ISO639_1;
98
+ /** ISO 639-3 three-letter code */
99
+ iso639_3: ISO639_3;
100
+ }
101
+ /**
102
+ * Converts an ISO 639-1 (2-letter) code to ISO 639-3 (3-letter) code.
103
+ *
104
+ * @param code - ISO 639-1 two-letter language code (e.g., "en", "fr")
105
+ * @returns ISO 639-3 three-letter code, or the original if not found
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * toISO639_3("en") // "eng"
110
+ * toISO639_3("fr") // "fra"
111
+ * toISO639_3("ja") // "jpn"
112
+ * ```
113
+ */
114
+ declare function toISO639_3(code: string): ISO639_3;
115
+ /**
116
+ * Converts an ISO 639-3 (3-letter) code to ISO 639-1 (2-letter) code.
117
+ *
118
+ * @param code - ISO 639-3 three-letter language code (e.g., "eng", "fra")
119
+ * @returns ISO 639-1 two-letter code, or the original if not found
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * toISO639_1("eng") // "en"
124
+ * toISO639_1("fra") // "fr"
125
+ * toISO639_1("jpn") // "ja"
126
+ * ```
127
+ */
128
+ declare function toISO639_1(code: string): ISO639_1;
129
+ /**
130
+ * Returns both ISO 639-1 and ISO 639-3 codes for a given language code.
131
+ * Accepts either format as input and normalizes to both.
132
+ *
133
+ * @param code - Language code in either ISO 639-1 or ISO 639-3 format
134
+ * @returns Object containing both code formats
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * getLanguageCodePair("en") // { iso639_1: "en", iso639_3: "eng" }
139
+ * getLanguageCodePair("fra") // { iso639_1: "fr", iso639_3: "fra" }
140
+ * ```
141
+ */
142
+ declare function getLanguageCodePair(code: string): LanguageCodePair;
143
+ /**
144
+ * Validates if a code is a known ISO 639-1 code.
145
+ *
146
+ * @param code - Code to validate
147
+ * @returns true if the code is a known ISO 639-1 code
148
+ */
149
+ declare function isValidISO639_1(code: string): boolean;
150
+ /**
151
+ * Validates if a code is a known ISO 639-3 code.
152
+ *
153
+ * @param code - Code to validate
154
+ * @returns true if the code is a known ISO 639-3 code
155
+ */
156
+ declare function isValidISO639_3(code: string): boolean;
157
+ /**
158
+ * Returns true if the given language code represents an undetermined,
159
+ * multiple, miscellaneous, or non-linguistic language tag.
160
+ */
161
+ declare function isUndeterminedLanguageCode(code: string): boolean;
162
+ /**
163
+ * Gets the human-readable language name for a given code.
164
+ * Returns `undefined` for undetermined / special language codes
165
+ * that should not be used as LLM output language instructions.
166
+ *
167
+ * @param code - Language code in either ISO 639-1 or ISO 639-3 format
168
+ * @returns Human-readable language name (e.g., "English", "French"), or undefined for undetermined codes
169
+ */
170
+ declare function getLanguageName(code: string): string | undefined;
171
+
7
172
  interface ImageDownloadOptions {
8
173
  /** Request timeout in milliseconds (default: 10000) */
9
174
  timeout?: number;
@@ -1048,101 +1213,6 @@ interface SummarizationOptions extends MuxAIOptions {
1048
1213
  }
1049
1214
  declare function getSummaryAndTags(assetId: string, options?: SummarizationOptions): Promise<SummaryAndTagsResult>;
1050
1215
 
1051
- /**
1052
- * Language Code Conversion Utilities
1053
- *
1054
- * Provides bidirectional mapping between:
1055
- * - ISO 639-1 (2-letter codes) - Used by browsers, BCP-47, most video players
1056
- * - ISO 639-3 (3-letter codes) - Used by various APIs and language processing systems
1057
- *
1058
- * This is essential for interoperability between different systems:
1059
- * - Mux uses ISO 639-1 for track language codes
1060
- * - Browser players expect BCP-47 compliant codes (based on ISO 639-1)
1061
- * - Some APIs require ISO 639-3 (3-letter) codes
1062
- */
1063
- /**
1064
- * Mapping from ISO 639-1 (2-letter) to ISO 639-3 (3-letter) codes.
1065
- * Covers the most common languages used in video translation.
1066
- *
1067
- * Reference: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
1068
- */
1069
- declare const ISO639_1_TO_3: {
1070
- readonly en: "eng";
1071
- readonly es: "spa";
1072
- readonly fr: "fra";
1073
- readonly de: "deu";
1074
- readonly it: "ita";
1075
- readonly pt: "por";
1076
- readonly ru: "rus";
1077
- readonly zh: "zho";
1078
- readonly ja: "jpn";
1079
- readonly ko: "kor";
1080
- readonly ar: "ara";
1081
- readonly hi: "hin";
1082
- readonly nl: "nld";
1083
- readonly pl: "pol";
1084
- readonly sv: "swe";
1085
- readonly da: "dan";
1086
- readonly no: "nor";
1087
- readonly fi: "fin";
1088
- readonly el: "ell";
1089
- readonly cs: "ces";
1090
- readonly hu: "hun";
1091
- readonly ro: "ron";
1092
- readonly bg: "bul";
1093
- readonly hr: "hrv";
1094
- readonly sk: "slk";
1095
- readonly sl: "slv";
1096
- readonly uk: "ukr";
1097
- readonly tr: "tur";
1098
- readonly th: "tha";
1099
- readonly vi: "vie";
1100
- readonly id: "ind";
1101
- readonly ms: "msa";
1102
- readonly tl: "tgl";
1103
- readonly he: "heb";
1104
- readonly fa: "fas";
1105
- readonly bn: "ben";
1106
- readonly ta: "tam";
1107
- readonly te: "tel";
1108
- readonly mr: "mar";
1109
- readonly gu: "guj";
1110
- readonly kn: "kan";
1111
- readonly ml: "mal";
1112
- readonly pa: "pan";
1113
- readonly ur: "urd";
1114
- readonly sw: "swa";
1115
- readonly af: "afr";
1116
- readonly ca: "cat";
1117
- readonly eu: "eus";
1118
- readonly gl: "glg";
1119
- readonly is: "isl";
1120
- readonly et: "est";
1121
- readonly lv: "lav";
1122
- readonly lt: "lit";
1123
- };
1124
- /**
1125
- * Supported ISO 639-1 two-letter language codes.
1126
- * These are the language codes supported for translation workflows.
1127
- */
1128
- type SupportedISO639_1 = keyof typeof ISO639_1_TO_3;
1129
- /**
1130
- * Supported ISO 639-3 three-letter language codes.
1131
- * These are the language codes supported for translation workflows.
1132
- */
1133
- type SupportedISO639_3 = (typeof ISO639_1_TO_3)[SupportedISO639_1];
1134
- /** ISO 639-1 two-letter language code (e.g., "en", "fr", "es") */
1135
- type ISO639_1 = SupportedISO639_1 | (string & {});
1136
- /** ISO 639-3 three-letter language code (e.g., "eng", "fra", "spa") */
1137
- type ISO639_3 = SupportedISO639_3 | (string & {});
1138
- /** Structured language code result containing both formats */
1139
- interface LanguageCodePair {
1140
- /** ISO 639-1 two-letter code (BCP-47 compatible) */
1141
- iso639_1: ISO639_1;
1142
- /** ISO 639-3 three-letter code */
1143
- iso639_3: ISO639_3;
1144
- }
1145
-
1146
1216
  /** Output returned from `translateAudio`. */
1147
1217
  interface AudioTranslationResult {
1148
1218
  assetId: string;
@@ -1426,4 +1496,4 @@ declare namespace index {
1426
1496
  export { type index_AskQuestionsOptions as AskQuestionsOptions, type index_AskQuestionsResult as AskQuestionsResult, type index_AskQuestionsType as AskQuestionsType, type index_AudioTranslationOptions as AudioTranslationOptions, type index_AudioTranslationResult as AudioTranslationResult, type index_AutoCensorProfanityOptions as AutoCensorProfanityOptions, type index_BurnedInCaptionsAnalysis as BurnedInCaptionsAnalysis, type index_BurnedInCaptionsOptions as BurnedInCaptionsOptions, type index_BurnedInCaptionsPromptOverrides as BurnedInCaptionsPromptOverrides, type index_BurnedInCaptionsPromptSections as BurnedInCaptionsPromptSections, type index_BurnedInCaptionsResult as BurnedInCaptionsResult, type index_CaptionReplacement as CaptionReplacement, type index_CensorMode as CensorMode, type index_Chapter as Chapter, type index_ChapterSystemPromptSections as ChapterSystemPromptSections, type index_ChaptersOptions as ChaptersOptions, type index_ChaptersPromptOverrides as ChaptersPromptOverrides, type index_ChaptersPromptSections as ChaptersPromptSections, type index_ChaptersResult as ChaptersResult, type index_ChaptersType as ChaptersType, index_DEFAULT_DESCRIPTION_LENGTH as DEFAULT_DESCRIPTION_LENGTH, index_DEFAULT_SUMMARY_KEYWORD_LIMIT as DEFAULT_SUMMARY_KEYWORD_LIMIT, index_DEFAULT_TITLE_LENGTH as DEFAULT_TITLE_LENGTH, type index_EditCaptionsOptions as EditCaptionsOptions, type index_EditCaptionsResult as EditCaptionsResult, type index_EmbeddingsOptions as EmbeddingsOptions, type index_EmbeddingsResult as EmbeddingsResult, type index_EngagementInsightsOptions as EngagementInsightsOptions, type index_EngagementInsightsResult as EngagementInsightsResult, index_GOOGLE_VISION_LIKELIHOOD_TO_SCORE as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, index_HIVE_SEXUAL_CATEGORIES as HIVE_SEXUAL_CATEGORIES, index_HIVE_VIOLENCE_CATEGORIES as HIVE_VIOLENCE_CATEGORIES, type index_HiveModerationOutput as HiveModerationOutput, type index_HiveModerationSource as HiveModerationSource, type index_ModerationOptions as ModerationOptions, type index_ModerationProvider as ModerationProvider, type index_ModerationResult as ModerationResult, type index_MomentInsight as MomentInsight, type index_OverallInsight as OverallInsight, type index_ProfanityDetectionPayload as ProfanityDetectionPayload, type index_Question as Question, type index_QuestionAnswer as QuestionAnswer, type index_QuestionAnswerType as QuestionAnswerType, type index_ReplacementRecord as ReplacementRecord, type index_SummarizationOptions as SummarizationOptions, type index_SummarizationPromptOverrides as SummarizationPromptOverrides, type index_SummarizationPromptSections as SummarizationPromptSections, type index_SummaryAndTagsResult as SummaryAndTagsResult, type index_SummaryType as SummaryType, type index_ThumbnailModerationScore as ThumbnailModerationScore, type index_TranslationChunkingOptions as TranslationChunkingOptions, type index_TranslationOptions as TranslationOptions, type index_TranslationPayload as TranslationPayload, type index_TranslationResult as TranslationResult, index_aggregateTokenUsage as aggregateTokenUsage, index_applyOverrideLists as applyOverrideLists, index_applyReplacements as applyReplacements, index_askQuestions as askQuestions, index_buildReplacementRegex as buildReplacementRegex, index_burnedInCaptionsSchema as burnedInCaptionsSchema, index_censorVttContent as censorVttContent, index_chapterSchema as chapterSchema, index_chaptersSchema as chaptersSchema, index_createReplacer as createReplacer, index_editCaptions as editCaptions, index_extractTranscriptSegmentsForHotspots as extractTranscriptSegmentsForHotspots, index_generateChapters as generateChapters, index_generateEmbeddings as generateEmbeddings, index_generateEngagementInsights as generateEngagementInsights, index_generateVideoEmbeddings as generateVideoEmbeddings, index_getModerationScores as getModerationScores, index_getSummaryAndTags as getSummaryAndTags, index_hasBurnedInCaptions as hasBurnedInCaptions, index_mapShotsToHotspots as mapShotsToHotspots, index_normalizeTranslatedVtt as normalizeTranslatedVtt, index_profanityDetectionSchema as profanityDetectionSchema, index_questionAnswerSchema as questionAnswerSchema, index_shouldSplitChunkTranslationError as shouldSplitChunkTranslationError, index_summarySchema as summarySchema, index_transformCueText as transformCueText, index_translateAudio as translateAudio, index_translateCaptions as translateCaptions, index_translationSchema as translationSchema };
1427
1497
  }
1428
1498
 
1429
- export { type TranslationPayload as $, type AskQuestionsOptions as A, type BurnedInCaptionsAnalysis as B, type CaptionReplacement as C, DEFAULT_DESCRIPTION_LENGTH as D, type EditCaptionsOptions as E, type HiveModerationOutput as F, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as G, HIVE_SEXUAL_CATEGORIES as H, type HiveModerationSource as I, type ModerationProvider as J, type ModerationResult as K, type MomentInsight as L, type ModerationOptions as M, type QuestionAnswer as N, type OverallInsight as O, type ProfanityDetectionPayload as P, type Question as Q, type QuestionAnswerType as R, type ReplacementRecord as S, type SummarizationOptions as T, type SummarizationPromptOverrides as U, type SummarizationPromptSections as V, type SummaryAndTagsResult as W, type SummaryType as X, type ThumbnailModerationScore as Y, type TranslationChunkingOptions as Z, type TranslationOptions as _, type AskQuestionsResult as a, type TranslationResult as a0, aggregateTokenUsage as a1, applyOverrideLists as a2, applyReplacements as a3, askQuestions as a4, buildReplacementRegex as a5, burnedInCaptionsSchema as a6, censorVttContent as a7, chapterSchema as a8, chaptersSchema as a9, createReplacer as aa, editCaptions as ab, extractTranscriptSegmentsForHotspots as ac, generateChapters as ad, generateEmbeddings as ae, generateEngagementInsights as af, generateVideoEmbeddings as ag, getModerationScores as ah, getSummaryAndTags as ai, hasBurnedInCaptions as aj, mapShotsToHotspots as ak, normalizeTranslatedVtt as al, profanityDetectionSchema as am, questionAnswerSchema as an, shouldSplitChunkTranslationError as ao, summarySchema as ap, transformCueText as aq, translateAudio as ar, translateCaptions as as, translationSchema as at, type AskQuestionsType as b, type AudioTranslationOptions as c, type AudioTranslationResult as d, type AutoCensorProfanityOptions as e, type BurnedInCaptionsOptions as f, type BurnedInCaptionsPromptOverrides as g, type BurnedInCaptionsPromptSections as h, index as i, type BurnedInCaptionsResult as j, type CensorMode as k, type Chapter as l, type ChapterSystemPromptSections as m, type ChaptersOptions as n, type ChaptersPromptOverrides as o, type ChaptersPromptSections as p, type ChaptersResult as q, type ChaptersType as r, DEFAULT_SUMMARY_KEYWORD_LIMIT as s, DEFAULT_TITLE_LENGTH as t, type EditCaptionsResult as u, type EmbeddingsOptions as v, type EmbeddingsResult as w, type EngagementInsightsOptions as x, type EngagementInsightsResult as y, HIVE_VIOLENCE_CATEGORIES as z };
1499
+ export { type Question as $, type AskQuestionsOptions as A, type BurnedInCaptionsAnalysis as B, type CaptionReplacement as C, type ChaptersType as D, DEFAULT_DESCRIPTION_LENGTH as E, DEFAULT_SUMMARY_KEYWORD_LIMIT as F, DEFAULT_TITLE_LENGTH as G, type EditCaptionsOptions as H, type ISO639_1 as I, type EditCaptionsResult as J, type EmbeddingsOptions as K, type LanguageCodePair as L, type EmbeddingsResult as M, type EngagementInsightsOptions as N, type EngagementInsightsResult as O, GOOGLE_VISION_LIKELIHOOD_TO_SCORE as P, HIVE_SEXUAL_CATEGORIES as Q, HIVE_VIOLENCE_CATEGORIES as R, type SupportedISO639_1 as S, type HiveModerationOutput as T, type HiveModerationSource as U, type ModerationOptions as V, type ModerationProvider as W, type ModerationResult as X, type MomentInsight as Y, type OverallInsight as Z, type ProfanityDetectionPayload as _, type ISO639_3 as a, type QuestionAnswer as a0, type QuestionAnswerType as a1, type ReplacementRecord as a2, type SummarizationOptions as a3, type SummarizationPromptOverrides as a4, type SummarizationPromptSections as a5, type SummaryAndTagsResult as a6, type SummaryType as a7, type ThumbnailModerationScore as a8, type TranslationChunkingOptions as a9, shouldSplitChunkTranslationError as aA, summarySchema as aB, transformCueText as aC, translateAudio as aD, translateCaptions as aE, translationSchema as aF, type TranslationOptions as aa, type TranslationPayload as ab, type TranslationResult as ac, aggregateTokenUsage as ad, applyOverrideLists as ae, applyReplacements as af, askQuestions as ag, buildReplacementRegex as ah, burnedInCaptionsSchema as ai, censorVttContent as aj, chapterSchema as ak, chaptersSchema as al, createReplacer as am, editCaptions as an, extractTranscriptSegmentsForHotspots as ao, generateChapters as ap, generateEmbeddings as aq, generateEngagementInsights as ar, generateVideoEmbeddings as as, getModerationScores as at, getSummaryAndTags as au, hasBurnedInCaptions as av, mapShotsToHotspots as aw, normalizeTranslatedVtt as ax, profanityDetectionSchema as ay, questionAnswerSchema as az, type SupportedISO639_3 as b, getLanguageName as c, isValidISO639_1 as d, isValidISO639_3 as e, toISO639_3 as f, getLanguageCodePair as g, index as h, isUndeterminedLanguageCode as i, type AskQuestionsResult as j, type AskQuestionsType as k, type AudioTranslationOptions as l, type AudioTranslationResult as m, type AutoCensorProfanityOptions as n, type BurnedInCaptionsOptions as o, type BurnedInCaptionsPromptOverrides as p, type BurnedInCaptionsPromptSections as q, type BurnedInCaptionsResult as r, type CensorMode as s, toISO639_1 as t, type Chapter as u, type ChapterSystemPromptSections as v, type ChaptersOptions as w, type ChaptersPromptOverrides as x, type ChaptersPromptSections as y, type ChaptersResult as z };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
+ export { I as ISO639_1, a as ISO639_3, L as LanguageCodePair, S as SupportedISO639_1, b as SupportedISO639_3, g as getLanguageCodePair, c as getLanguageName, i as isUndeterminedLanguageCode, d as isValidISO639_1, e as isValidISO639_3, t as toISO639_1, f as toISO639_3, h as workflows } from './index-0a27mjs2.js';
1
2
  import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './shots-mGJfYGiO.js';
2
3
  export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as StorageAdapter, T as TextChunk, g as TokenChunkingConfig, h as TokenUsage, i as ToneType, U as UsageMetadata, V as VTTChunkingConfig, j as VideoEmbeddingsResult, k as WorkflowCredentialsInput, l as WorkflowMuxClient, m as decryptFromWorkflow, n as encryptForWorkflow } from './shots-mGJfYGiO.js';
3
4
  import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
4
5
  export { i as primitives } from './index-bjQi1ZCj.js';
5
- export { i as workflows } from './index-DwNtsg-u.js';
6
- import '@mux/mux-node';
7
6
  import 'zod';
8
7
  import '@ai-sdk/anthropic';
9
8
  import '@ai-sdk/google';
10
9
  import '@ai-sdk/openai';
10
+ import '@mux/mux-node';
11
11
 
12
- var version = "0.21.2";
12
+ var version = "0.22.0";
13
13
 
14
14
  type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error";
15
15
  /**
package/dist/index.js CHANGED
@@ -5,7 +5,178 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // package.json
8
- var version = "0.21.2";
8
+ var version = "0.22.0";
9
+
10
+ // src/lib/language-codes.ts
11
+ var ISO639_1_TO_3 = {
12
+ // Major world languages
13
+ en: "eng",
14
+ // English
15
+ es: "spa",
16
+ // Spanish
17
+ fr: "fra",
18
+ // French
19
+ de: "deu",
20
+ // German
21
+ it: "ita",
22
+ // Italian
23
+ pt: "por",
24
+ // Portuguese
25
+ ru: "rus",
26
+ // Russian
27
+ zh: "zho",
28
+ // Chinese
29
+ ja: "jpn",
30
+ // Japanese
31
+ ko: "kor",
32
+ // Korean
33
+ ar: "ara",
34
+ // Arabic
35
+ hi: "hin",
36
+ // Hindi
37
+ // European languages
38
+ nl: "nld",
39
+ // Dutch
40
+ pl: "pol",
41
+ // Polish
42
+ sv: "swe",
43
+ // Swedish
44
+ da: "dan",
45
+ // Danish
46
+ no: "nor",
47
+ // Norwegian
48
+ fi: "fin",
49
+ // Finnish
50
+ el: "ell",
51
+ // Greek
52
+ cs: "ces",
53
+ // Czech
54
+ hu: "hun",
55
+ // Hungarian
56
+ ro: "ron",
57
+ // Romanian
58
+ bg: "bul",
59
+ // Bulgarian
60
+ hr: "hrv",
61
+ // Croatian
62
+ sk: "slk",
63
+ // Slovak
64
+ sl: "slv",
65
+ // Slovenian
66
+ uk: "ukr",
67
+ // Ukrainian
68
+ tr: "tur",
69
+ // Turkish
70
+ // Asian languages
71
+ th: "tha",
72
+ // Thai
73
+ vi: "vie",
74
+ // Vietnamese
75
+ id: "ind",
76
+ // Indonesian
77
+ ms: "msa",
78
+ // Malay
79
+ tl: "tgl",
80
+ // Tagalog/Filipino
81
+ // Other languages
82
+ he: "heb",
83
+ // Hebrew
84
+ fa: "fas",
85
+ // Persian/Farsi
86
+ bn: "ben",
87
+ // Bengali
88
+ ta: "tam",
89
+ // Tamil
90
+ te: "tel",
91
+ // Telugu
92
+ mr: "mar",
93
+ // Marathi
94
+ gu: "guj",
95
+ // Gujarati
96
+ kn: "kan",
97
+ // Kannada
98
+ ml: "mal",
99
+ // Malayalam
100
+ pa: "pan",
101
+ // Punjabi
102
+ ur: "urd",
103
+ // Urdu
104
+ sw: "swa",
105
+ // Swahili
106
+ af: "afr",
107
+ // Afrikaans
108
+ ca: "cat",
109
+ // Catalan
110
+ eu: "eus",
111
+ // Basque
112
+ gl: "glg",
113
+ // Galician
114
+ is: "isl",
115
+ // Icelandic
116
+ et: "est",
117
+ // Estonian
118
+ lv: "lav",
119
+ // Latvian
120
+ lt: "lit"
121
+ // Lithuanian
122
+ };
123
+ var ISO639_3_TO_1 = Object.fromEntries(
124
+ Object.entries(ISO639_1_TO_3).map(([iso1, iso3]) => [iso3, iso1])
125
+ );
126
+ function toISO639_3(code) {
127
+ const normalized = code.toLowerCase().trim();
128
+ if (normalized.length === 3) {
129
+ return normalized;
130
+ }
131
+ return ISO639_1_TO_3[normalized] ?? normalized;
132
+ }
133
+ function toISO639_1(code) {
134
+ const normalized = code.toLowerCase().trim();
135
+ if (normalized.length === 2) {
136
+ return normalized;
137
+ }
138
+ return ISO639_3_TO_1[normalized] ?? normalized;
139
+ }
140
+ function getLanguageCodePair(code) {
141
+ const normalized = code.toLowerCase().trim();
142
+ if (normalized.length === 2) {
143
+ return {
144
+ iso639_1: normalized,
145
+ iso639_3: toISO639_3(normalized)
146
+ };
147
+ } else if (normalized.length === 3) {
148
+ return {
149
+ iso639_1: toISO639_1(normalized),
150
+ iso639_3: normalized
151
+ };
152
+ }
153
+ return {
154
+ iso639_1: normalized,
155
+ iso639_3: normalized
156
+ };
157
+ }
158
+ function isValidISO639_1(code) {
159
+ return code.length === 2 && code.toLowerCase() in ISO639_1_TO_3;
160
+ }
161
+ function isValidISO639_3(code) {
162
+ return code.length === 3 && code.toLowerCase() in ISO639_3_TO_1;
163
+ }
164
+ var UNDETERMINED_LANGUAGE_CODES = /* @__PURE__ */ new Set(["und", "mul", "mis", "zxx"]);
165
+ function isUndeterminedLanguageCode(code) {
166
+ return UNDETERMINED_LANGUAGE_CODES.has(code.toLowerCase().trim());
167
+ }
168
+ function getLanguageName(code) {
169
+ if (isUndeterminedLanguageCode(code)) {
170
+ return void 0;
171
+ }
172
+ const iso639_1 = toISO639_1(code);
173
+ try {
174
+ const displayNames = new Intl.DisplayNames(["en"], { type: "language" });
175
+ return displayNames.of(iso639_1) ?? code.toUpperCase();
176
+ } catch {
177
+ return code.toUpperCase();
178
+ }
179
+ }
9
180
 
10
181
  // src/lib/prompt-fragments.ts
11
182
  import dedent from "dedent";
@@ -1926,171 +2097,6 @@ async function getThumbnailUrls(playbackId, duration, options = {}) {
1926
2097
  return Promise.all(urlPromises);
1927
2098
  }
1928
2099
 
1929
- // src/lib/language-codes.ts
1930
- var ISO639_1_TO_3 = {
1931
- // Major world languages
1932
- en: "eng",
1933
- // English
1934
- es: "spa",
1935
- // Spanish
1936
- fr: "fra",
1937
- // French
1938
- de: "deu",
1939
- // German
1940
- it: "ita",
1941
- // Italian
1942
- pt: "por",
1943
- // Portuguese
1944
- ru: "rus",
1945
- // Russian
1946
- zh: "zho",
1947
- // Chinese
1948
- ja: "jpn",
1949
- // Japanese
1950
- ko: "kor",
1951
- // Korean
1952
- ar: "ara",
1953
- // Arabic
1954
- hi: "hin",
1955
- // Hindi
1956
- // European languages
1957
- nl: "nld",
1958
- // Dutch
1959
- pl: "pol",
1960
- // Polish
1961
- sv: "swe",
1962
- // Swedish
1963
- da: "dan",
1964
- // Danish
1965
- no: "nor",
1966
- // Norwegian
1967
- fi: "fin",
1968
- // Finnish
1969
- el: "ell",
1970
- // Greek
1971
- cs: "ces",
1972
- // Czech
1973
- hu: "hun",
1974
- // Hungarian
1975
- ro: "ron",
1976
- // Romanian
1977
- bg: "bul",
1978
- // Bulgarian
1979
- hr: "hrv",
1980
- // Croatian
1981
- sk: "slk",
1982
- // Slovak
1983
- sl: "slv",
1984
- // Slovenian
1985
- uk: "ukr",
1986
- // Ukrainian
1987
- tr: "tur",
1988
- // Turkish
1989
- // Asian languages
1990
- th: "tha",
1991
- // Thai
1992
- vi: "vie",
1993
- // Vietnamese
1994
- id: "ind",
1995
- // Indonesian
1996
- ms: "msa",
1997
- // Malay
1998
- tl: "tgl",
1999
- // Tagalog/Filipino
2000
- // Other languages
2001
- he: "heb",
2002
- // Hebrew
2003
- fa: "fas",
2004
- // Persian/Farsi
2005
- bn: "ben",
2006
- // Bengali
2007
- ta: "tam",
2008
- // Tamil
2009
- te: "tel",
2010
- // Telugu
2011
- mr: "mar",
2012
- // Marathi
2013
- gu: "guj",
2014
- // Gujarati
2015
- kn: "kan",
2016
- // Kannada
2017
- ml: "mal",
2018
- // Malayalam
2019
- pa: "pan",
2020
- // Punjabi
2021
- ur: "urd",
2022
- // Urdu
2023
- sw: "swa",
2024
- // Swahili
2025
- af: "afr",
2026
- // Afrikaans
2027
- ca: "cat",
2028
- // Catalan
2029
- eu: "eus",
2030
- // Basque
2031
- gl: "glg",
2032
- // Galician
2033
- is: "isl",
2034
- // Icelandic
2035
- et: "est",
2036
- // Estonian
2037
- lv: "lav",
2038
- // Latvian
2039
- lt: "lit"
2040
- // Lithuanian
2041
- };
2042
- var ISO639_3_TO_1 = Object.fromEntries(
2043
- Object.entries(ISO639_1_TO_3).map(([iso1, iso3]) => [iso3, iso1])
2044
- );
2045
- function toISO639_3(code) {
2046
- const normalized = code.toLowerCase().trim();
2047
- if (normalized.length === 3) {
2048
- return normalized;
2049
- }
2050
- return ISO639_1_TO_3[normalized] ?? normalized;
2051
- }
2052
- function toISO639_1(code) {
2053
- const normalized = code.toLowerCase().trim();
2054
- if (normalized.length === 2) {
2055
- return normalized;
2056
- }
2057
- return ISO639_3_TO_1[normalized] ?? normalized;
2058
- }
2059
- function getLanguageCodePair(code) {
2060
- const normalized = code.toLowerCase().trim();
2061
- if (normalized.length === 2) {
2062
- return {
2063
- iso639_1: normalized,
2064
- iso639_3: toISO639_3(normalized)
2065
- };
2066
- } else if (normalized.length === 3) {
2067
- return {
2068
- iso639_1: toISO639_1(normalized),
2069
- iso639_3: normalized
2070
- };
2071
- }
2072
- return {
2073
- iso639_1: normalized,
2074
- iso639_3: normalized
2075
- };
2076
- }
2077
- var UNDETERMINED_LANGUAGE_CODES = /* @__PURE__ */ new Set(["und", "mul", "mis", "zxx"]);
2078
- function isUndeterminedLanguageCode(code) {
2079
- return UNDETERMINED_LANGUAGE_CODES.has(code.toLowerCase().trim());
2080
- }
2081
- function getLanguageName(code) {
2082
- if (isUndeterminedLanguageCode(code)) {
2083
- return void 0;
2084
- }
2085
- const iso639_1 = toISO639_1(code);
2086
- try {
2087
- const displayNames = new Intl.DisplayNames(["en"], { type: "language" });
2088
- return displayNames.of(iso639_1) ?? code.toUpperCase();
2089
- } catch {
2090
- return code.toUpperCase();
2091
- }
2092
- }
2093
-
2094
2100
  // src/lib/mux-assets.ts
2095
2101
  function getPlaybackId(asset) {
2096
2102
  const playbackIds = asset.playback_ids || [];
@@ -7443,8 +7449,15 @@ export {
7443
7449
  createWorkflowStorageClient,
7444
7450
  decryptFromWorkflow,
7445
7451
  encryptForWorkflow,
7452
+ getLanguageCodePair,
7453
+ getLanguageName,
7454
+ isUndeterminedLanguageCode,
7455
+ isValidISO639_1,
7456
+ isValidISO639_3,
7446
7457
  primitives_exports as primitives,
7447
7458
  setWorkflowCredentialsProvider,
7459
+ toISO639_1,
7460
+ toISO639_3,
7448
7461
  version,
7449
7462
  workflows_exports as workflows,
7450
7463
  wrapError