@mux/ai 0.45.0 → 0.46.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.
- package/dist/{index-BD4acrwt.d.ts → index-CIcGZD3x.d.ts} +7 -7
- package/dist/{index-D6VGaoPm.d.ts → index-DAuzEXly.d.ts} +11 -11
- package/dist/index.d.ts +6 -6
- package/dist/index.js +56 -67
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +3 -3
- package/dist/primitives/index.js +55 -66
- package/dist/primitives/index.js.map +1 -1
- package/dist/{shots-B7G0IIF1.d.ts → shots-BwpjZDpr.d.ts} +3 -3
- package/dist/workflows/index.d.ts +3 -3
- package/dist/workflows/index.js +51 -60
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Mux from '@mux/
|
|
1
|
+
import Mux from '@mux/ts';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Workflow Crypto
|
|
@@ -171,7 +171,7 @@ type WorkflowCredentialsInput = WorkflowCredentials | Encrypted<WorkflowCredenti
|
|
|
171
171
|
type ToneType = "neutral" | "playful" | "professional";
|
|
172
172
|
/** Common transport for image-based workflows. */
|
|
173
173
|
type ImageSubmissionMode = "url" | "base64";
|
|
174
|
-
/** Result of calling
|
|
174
|
+
/** Result of calling the Mux SDK asset retrieval helper. */
|
|
175
175
|
type MuxAsset = Awaited<ReturnType<Mux["video"]["assets"]["retrieve"]>>;
|
|
176
176
|
/** Single ready track extracted from a Mux asset. */
|
|
177
177
|
type AssetTextTrack = NonNullable<MuxAsset["tracks"]>[number];
|
|
@@ -294,7 +294,7 @@ interface HotspotOptions {
|
|
|
294
294
|
limit?: number;
|
|
295
295
|
/** Sort order: 'asc' or 'desc' (default: 'desc') */
|
|
296
296
|
orderDirection?: "asc" | "desc";
|
|
297
|
-
/**
|
|
297
|
+
/** @deprecated The API always orders by score; this option is ignored. */
|
|
298
298
|
orderBy?: "score";
|
|
299
299
|
/** Time window for results, e.g., '7:days' (default: '7:days') */
|
|
300
300
|
timeframe?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { E as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, F as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, G as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, H as ASK_QUESTIONS_MAX_QUESTION_LENGTH, J as AskQuestionsOptions, K as AskQuestionsResult, N as AskQuestionsType, O as AudioTranslationOptions, P as AudioTranslationResult, Q as AutoCensorProfanityOptions, U as BurnedInCaptionsAnalysis, V as BurnedInCaptionsOptions, W as BurnedInCaptionsPromptOverrides, X as BurnedInCaptionsPromptSections, Y as BurnedInCaptionsResult, Z as CaptionReplacement, _ as CensorMode, $ as Chapter, a0 as ChapterSystemPromptSections, a1 as ChaptersOptions, a2 as ChaptersPromptOverrides, a3 as ChaptersPromptSections, a4 as ChaptersResult, a5 as ChaptersType, a6 as EditCaptionsOptions, a7 as EditCaptionsResult, a8 as EmbeddingsOptions, a9 as EmbeddingsResult, aa as EngagementInsightsOptions, ab as EngagementInsightsResult, ac as GENERATE_TEXT_CALLS_TO_ACTION, ad as GENERATE_TEXT_CHANNELS, ae as GENERATE_TEXT_CHANNEL_CEILINGS, af as GENERATE_TEXT_FORMATS, ag as GENERATE_TEXT_LENGTH_BOUNDS, ah as GENERATE_TEXT_MAX_ARTIFACTS, ai as GENERATE_TEXT_MAX_AUDIENCE_CHARS, aj as GENERATE_TEXT_MAX_BRAND_TERMS, ak as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, al as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, am as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, an as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, ao as GENERATE_TEXT_MAX_SHOT_FRAMES, ap as GENERATE_TEXT_MAX_VARIANTS, aq as GENERATE_TEXT_VOICES, ar as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, as as GenerateTextArtifact, at as GenerateTextCallToAction, au as GenerateTextChannel, av as GenerateTextFormat, aw as GenerateTextKeyedItem, ax as GenerateTextLengthLimit, ay as GenerateTextOptions, az as GenerateTextResult, aA as GenerateTextVariant, aB as GenerateTextVoice, aC as GeneratedTextArtifact, aD as GeneratedTextVariant, aE as HIVE_SEXUAL_CATEGORIES, aF as HIVE_VIOLENCE_CATEGORIES, aG as HiveModerationOutput, aH as HiveModerationSource, aI as ModerationOptions, aJ as ModerationProvider, aK as ModerationResult, aL as MomentInsight, aM as OverallInsight, aN as ProfanityDetectionPayload, aO as Question, aP as QuestionAnswer, aQ as QuestionAnswerType, aR as ReplacementRecord, aS as SpeakerReplacement, aT as StaticRenditionCleanupOutcome, aU as SummarizationOptions, aV as SummarizationPromptOverrides, aW as SummarizationPromptSections, aX as SummaryAndTagsResult, aY as SummaryType, aZ as ThumbnailModerationScore, a_ as TranslationChunkingOptions, a$ as TranslationOptions, b0 as TranslationPayload, b1 as TranslationResult, b2 as aggregateTokenUsage, b3 as applyOverrideLists, b4 as applyReplacements, b5 as applySpeakerReplacements, b6 as askQuestions, b7 as buildReplacementRegex, b8 as burnedInCaptionsSchema, b9 as censorVttContent, ba as chapterSchema, bb as chaptersSchema, bc as createReplacer, bd as editCaptions, be as extractTranscriptSegmentsForHotspots, bf as findGenerateTextLengthViolation, bg as generateChapters, bh as generateEmbeddings, bi as generateEngagementInsights, bj as generateText, bk as generateVideoEmbeddings, bl as getModerationScores, bm as getSummaryAndTags, bn as hasBurnedInCaptions, bo as mapShotsToHotspots, bp as measureGenerateTextLength, bq as normalizeTranslatedVtt, br as profanityDetectionSchema, bs as questionAnswerSchema, bt as resolveGenerateTextLengthLimit, bu as resolveGenerateTextLengthLimits, bv as resolveGenerateTextOptions, bw as selectGenerateTextShotFrames, bx as shouldSplitChunkTranslationError, by as summarySchema, bz as transformCueText, bA as translateAudio, bB as translateCaptions, bC as translationSchema, bD as validateNeverTranslateTerms, bE as verifyNeverTranslateTerms } from '../index-
|
|
1
|
+
export { E as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, F as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, G as ASK_QUESTIONS_MAX_QUESTIONS_PER_CALL, H as ASK_QUESTIONS_MAX_QUESTION_LENGTH, J as AskQuestionsOptions, K as AskQuestionsResult, N as AskQuestionsType, O as AudioTranslationOptions, P as AudioTranslationResult, Q as AutoCensorProfanityOptions, U as BurnedInCaptionsAnalysis, V as BurnedInCaptionsOptions, W as BurnedInCaptionsPromptOverrides, X as BurnedInCaptionsPromptSections, Y as BurnedInCaptionsResult, Z as CaptionReplacement, _ as CensorMode, $ as Chapter, a0 as ChapterSystemPromptSections, a1 as ChaptersOptions, a2 as ChaptersPromptOverrides, a3 as ChaptersPromptSections, a4 as ChaptersResult, a5 as ChaptersType, a6 as EditCaptionsOptions, a7 as EditCaptionsResult, a8 as EmbeddingsOptions, a9 as EmbeddingsResult, aa as EngagementInsightsOptions, ab as EngagementInsightsResult, ac as GENERATE_TEXT_CALLS_TO_ACTION, ad as GENERATE_TEXT_CHANNELS, ae as GENERATE_TEXT_CHANNEL_CEILINGS, af as GENERATE_TEXT_FORMATS, ag as GENERATE_TEXT_LENGTH_BOUNDS, ah as GENERATE_TEXT_MAX_ARTIFACTS, ai as GENERATE_TEXT_MAX_AUDIENCE_CHARS, aj as GENERATE_TEXT_MAX_BRAND_TERMS, ak as GENERATE_TEXT_MAX_BRAND_TERMS_TOTAL_CHARS, al as GENERATE_TEXT_MAX_BRAND_TERM_CHARS, am as GENERATE_TEXT_MAX_CONCURRENT_GENERATIONS, an as GENERATE_TEXT_MAX_INSTRUCTIONS_CHARS, ao as GENERATE_TEXT_MAX_SHOT_FRAMES, ap as GENERATE_TEXT_MAX_VARIANTS, aq as GENERATE_TEXT_VOICES, ar as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, as as GenerateTextArtifact, at as GenerateTextCallToAction, au as GenerateTextChannel, av as GenerateTextFormat, aw as GenerateTextKeyedItem, ax as GenerateTextLengthLimit, ay as GenerateTextOptions, az as GenerateTextResult, aA as GenerateTextVariant, aB as GenerateTextVoice, aC as GeneratedTextArtifact, aD as GeneratedTextVariant, aE as HIVE_SEXUAL_CATEGORIES, aF as HIVE_VIOLENCE_CATEGORIES, aG as HiveModerationOutput, aH as HiveModerationSource, aI as ModerationOptions, aJ as ModerationProvider, aK as ModerationResult, aL as MomentInsight, aM as OverallInsight, aN as ProfanityDetectionPayload, aO as Question, aP as QuestionAnswer, aQ as QuestionAnswerType, aR as ReplacementRecord, aS as SpeakerReplacement, aT as StaticRenditionCleanupOutcome, aU as SummarizationOptions, aV as SummarizationPromptOverrides, aW as SummarizationPromptSections, aX as SummaryAndTagsResult, aY as SummaryType, aZ as ThumbnailModerationScore, a_ as TranslationChunkingOptions, a$ as TranslationOptions, b0 as TranslationPayload, b1 as TranslationResult, b2 as aggregateTokenUsage, b3 as applyOverrideLists, b4 as applyReplacements, b5 as applySpeakerReplacements, b6 as askQuestions, b7 as buildReplacementRegex, b8 as burnedInCaptionsSchema, b9 as censorVttContent, ba as chapterSchema, bb as chaptersSchema, bc as createReplacer, bd as editCaptions, be as extractTranscriptSegmentsForHotspots, bf as findGenerateTextLengthViolation, bg as generateChapters, bh as generateEmbeddings, bi as generateEngagementInsights, bj as generateText, bk as generateVideoEmbeddings, bl as getModerationScores, bm as getSummaryAndTags, bn as hasBurnedInCaptions, bo as mapShotsToHotspots, bp as measureGenerateTextLength, bq as normalizeTranslatedVtt, br as profanityDetectionSchema, bs as questionAnswerSchema, bt as resolveGenerateTextLengthLimit, bu as resolveGenerateTextLengthLimits, bv as resolveGenerateTextOptions, bw as selectGenerateTextShotFrames, bx as shouldSplitChunkTranslationError, by as summarySchema, bz as transformCueText, bA as translateAudio, bB as translateCaptions, bC as translationSchema, bD as validateNeverTranslateTerms, bE as verifyNeverTranslateTerms } from '../index-CIcGZD3x.js';
|
|
2
2
|
export { D as DEFAULT_DESCRIPTION_LENGTH, a as DEFAULT_SUMMARY_KEYWORD_LIMIT, b as DEFAULT_TITLE_LENGTH } from '../summarization-BFmhXeAu.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '@ai-sdk/anthropic';
|
|
5
5
|
import '@ai-sdk/google';
|
|
6
6
|
import '@ai-sdk/openai';
|
|
7
|
-
import '../shots-
|
|
8
|
-
import '@mux/
|
|
7
|
+
import '../shots-BwpjZDpr.js';
|
|
8
|
+
import '@mux/ts';
|
package/dist/workflows/index.js
CHANGED
|
@@ -1173,7 +1173,7 @@ function resolveDirectMuxCredentials(record) {
|
|
|
1173
1173
|
function createWorkflowMuxClient(options) {
|
|
1174
1174
|
return {
|
|
1175
1175
|
async createClient() {
|
|
1176
|
-
const { default: MuxClient } = await import("@mux/
|
|
1176
|
+
const { default: MuxClient } = await import("@mux/ts");
|
|
1177
1177
|
return new MuxClient({
|
|
1178
1178
|
tokenId: options.tokenId,
|
|
1179
1179
|
tokenSecret: options.tokenSecret,
|
|
@@ -1913,12 +1913,8 @@ async function getMuxThumbnailBaseUrl(playbackId, credentials) {
|
|
|
1913
1913
|
|
|
1914
1914
|
// src/lib/url-signing.ts
|
|
1915
1915
|
async function createSigningClient(context) {
|
|
1916
|
-
const { default: MuxClient } = await import("@mux/
|
|
1916
|
+
const { default: MuxClient } = await import("@mux/ts");
|
|
1917
1917
|
return new MuxClient({
|
|
1918
|
-
// These are not needed for signing, but the SDK requires them
|
|
1919
|
-
// Using empty strings as we only need the jwt functionality
|
|
1920
|
-
tokenId: env_default.MUX_TOKEN_ID || "",
|
|
1921
|
-
tokenSecret: env_default.MUX_TOKEN_SECRET || "",
|
|
1922
1918
|
jwtSigningKey: context.keyId,
|
|
1923
1919
|
jwtPrivateKey: context.keySecret
|
|
1924
1920
|
});
|
|
@@ -5389,25 +5385,22 @@ async function getHeatmapForAsset(assetId, options = {}) {
|
|
|
5389
5385
|
"use step";
|
|
5390
5386
|
return fetchHeatmap("assets", assetId, options);
|
|
5391
5387
|
}
|
|
5392
|
-
function transformHeatmapResponse(response) {
|
|
5393
|
-
return {
|
|
5394
|
-
assetId: response.data.asset_id,
|
|
5395
|
-
videoId: response.data.video_id,
|
|
5396
|
-
playbackId: response.data.playback_id,
|
|
5397
|
-
heatmap: response.data.heatmap,
|
|
5398
|
-
timeframe: response.timeframe
|
|
5399
|
-
};
|
|
5400
|
-
}
|
|
5401
5388
|
async function fetchHeatmap(identifierType, id, options) {
|
|
5402
5389
|
"use step";
|
|
5403
5390
|
const { timeframe = "7:days", credentials } = options;
|
|
5404
5391
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
5405
5392
|
const mux = await muxClient.createClient();
|
|
5406
|
-
const
|
|
5407
|
-
|
|
5408
|
-
const
|
|
5409
|
-
const
|
|
5410
|
-
return
|
|
5393
|
+
const query = { timeframe: [timeframe] };
|
|
5394
|
+
const resource = identifierType === "playback-ids" ? mux.data.engagement.playbackIds : mux.data.engagement[identifierType];
|
|
5395
|
+
const response = await resource.heatmap(id, query);
|
|
5396
|
+
const { data } = response;
|
|
5397
|
+
return {
|
|
5398
|
+
assetId: data.asset_id ?? (identifierType === "assets" ? id : void 0),
|
|
5399
|
+
videoId: data.video_id ?? (identifierType === "videos" ? id : void 0),
|
|
5400
|
+
playbackId: data.playback_id ?? (identifierType === "playback-ids" ? id : void 0),
|
|
5401
|
+
heatmap: data.heatmap,
|
|
5402
|
+
timeframe: response.timeframe
|
|
5403
|
+
};
|
|
5411
5404
|
}
|
|
5412
5405
|
|
|
5413
5406
|
// src/primitives/hotspots.ts
|
|
@@ -5416,43 +5409,37 @@ async function getHotspotsForAsset(assetId, options = {}) {
|
|
|
5416
5409
|
const response = await fetchHotspots("assets", assetId, options);
|
|
5417
5410
|
return response.hotspots;
|
|
5418
5411
|
}
|
|
5419
|
-
function transformHotspotResponse(response) {
|
|
5420
|
-
return {
|
|
5421
|
-
assetId: response.data.asset_id,
|
|
5422
|
-
videoId: response.data.video_id,
|
|
5423
|
-
playbackId: response.data.playback_id,
|
|
5424
|
-
hotspots: response.data.hotspots.map((h) => ({
|
|
5425
|
-
startMs: h.start_ms,
|
|
5426
|
-
endMs: h.end_ms,
|
|
5427
|
-
score: h.score
|
|
5428
|
-
}))
|
|
5429
|
-
};
|
|
5430
|
-
}
|
|
5431
5412
|
async function fetchHotspots(identifierType, id, options) {
|
|
5432
5413
|
"use step";
|
|
5433
5414
|
const {
|
|
5434
5415
|
limit = 5,
|
|
5435
5416
|
orderDirection = "desc",
|
|
5436
|
-
orderBy = "score",
|
|
5437
5417
|
timeframe = "7:days",
|
|
5438
5418
|
credentials
|
|
5439
5419
|
} = options;
|
|
5440
5420
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
5441
5421
|
const mux = await muxClient.createClient();
|
|
5442
|
-
const
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
const
|
|
5448
|
-
const response = await
|
|
5449
|
-
|
|
5422
|
+
const query = {
|
|
5423
|
+
limit,
|
|
5424
|
+
order_direction: orderDirection,
|
|
5425
|
+
timeframe: [timeframe]
|
|
5426
|
+
};
|
|
5427
|
+
const resource = identifierType === "playback-ids" ? mux.data.engagement.playbackIds : mux.data.engagement[identifierType];
|
|
5428
|
+
const response = await resource.hotspots(id, query);
|
|
5429
|
+
const { data } = response;
|
|
5430
|
+
return {
|
|
5431
|
+
assetId: data.asset_id ?? (identifierType === "assets" ? id : void 0),
|
|
5432
|
+
videoId: data.video_id ?? (identifierType === "videos" ? id : void 0),
|
|
5433
|
+
playbackId: data.playback_id ?? (identifierType === "playback-ids" ? id : void 0),
|
|
5434
|
+
hotspots: data.hotspots.map((h) => ({
|
|
5435
|
+
startMs: h.start_ms,
|
|
5436
|
+
endMs: h.end_ms,
|
|
5437
|
+
score: h.score
|
|
5438
|
+
}))
|
|
5439
|
+
};
|
|
5450
5440
|
}
|
|
5451
5441
|
|
|
5452
5442
|
// src/primitives/shots.ts
|
|
5453
|
-
function getShotsPath(assetId) {
|
|
5454
|
-
return `/video/v1/assets/${assetId}/shots`;
|
|
5455
|
-
}
|
|
5456
5443
|
function mapManifestShots(shots) {
|
|
5457
5444
|
let usedDeprecatedField = false;
|
|
5458
5445
|
const mapped = shots.map((shot, index) => {
|
|
@@ -5492,29 +5479,35 @@ async function fetchShotsFromManifest(shotsManifestUrl) {
|
|
|
5492
5479
|
}
|
|
5493
5480
|
return mapManifestShots(manifest.shots);
|
|
5494
5481
|
}
|
|
5495
|
-
async function transformShotsResponse(
|
|
5496
|
-
switch (
|
|
5482
|
+
async function transformShotsResponse(data) {
|
|
5483
|
+
switch (data.status) {
|
|
5497
5484
|
case "pending":
|
|
5498
5485
|
return {
|
|
5499
5486
|
status: "pending",
|
|
5500
|
-
createdAt:
|
|
5487
|
+
createdAt: data.created_at
|
|
5501
5488
|
};
|
|
5502
|
-
case "errored":
|
|
5489
|
+
case "errored": {
|
|
5490
|
+
const details = data.errors ?? data.error;
|
|
5503
5491
|
return {
|
|
5504
5492
|
status: "errored",
|
|
5505
|
-
createdAt:
|
|
5506
|
-
error:
|
|
5493
|
+
createdAt: data.created_at,
|
|
5494
|
+
error: {
|
|
5495
|
+
type: details?.type ?? "unknown",
|
|
5496
|
+
messages: details?.messages ?? []
|
|
5497
|
+
}
|
|
5507
5498
|
};
|
|
5499
|
+
}
|
|
5508
5500
|
case "completed":
|
|
5501
|
+
if (!data.shots_manifest_url) {
|
|
5502
|
+
throw new Error("Completed shots response is missing shots_manifest_url");
|
|
5503
|
+
}
|
|
5509
5504
|
return {
|
|
5510
5505
|
status: "completed",
|
|
5511
|
-
createdAt:
|
|
5512
|
-
shots: await fetchShotsFromManifest(
|
|
5506
|
+
createdAt: data.created_at,
|
|
5507
|
+
shots: await fetchShotsFromManifest(data.shots_manifest_url)
|
|
5513
5508
|
};
|
|
5514
|
-
default:
|
|
5515
|
-
|
|
5516
|
-
throw new Error(`Unsupported shots response: ${JSON.stringify(exhaustiveCheck)}`);
|
|
5517
|
-
}
|
|
5509
|
+
default:
|
|
5510
|
+
throw new Error(`Unsupported shots status '${data.status}'`);
|
|
5518
5511
|
}
|
|
5519
5512
|
}
|
|
5520
5513
|
async function getShotsForAsset(assetId, options = {}) {
|
|
@@ -5522,10 +5515,8 @@ async function getShotsForAsset(assetId, options = {}) {
|
|
|
5522
5515
|
const { credentials } = options;
|
|
5523
5516
|
const muxClient = await getMuxClientFromEnv(credentials);
|
|
5524
5517
|
const mux = await muxClient.createClient();
|
|
5525
|
-
const
|
|
5526
|
-
|
|
5527
|
-
);
|
|
5528
|
-
return await transformShotsResponse(response);
|
|
5518
|
+
const data = await mux.video.assets.retrieveShots(assetId);
|
|
5519
|
+
return await transformShotsResponse(data);
|
|
5529
5520
|
}
|
|
5530
5521
|
|
|
5531
5522
|
// src/workflows/engagement-insights.ts
|