@mux/ai 0.18.0 → 0.19.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.
@@ -520,6 +520,8 @@ interface AutoCensorProfanityOptions {
520
520
  interface CaptionReplacement {
521
521
  find: string;
522
522
  replace: string;
523
+ /** Match `find` with case-sensitivity. Defaults to `true`. */
524
+ caseSensitive?: boolean;
523
525
  }
524
526
  interface ReplacementRecord {
525
527
  cueStartTime: number;
@@ -649,9 +651,11 @@ declare function censorVttContent(rawVtt: string, profanity: string[], mode: Cen
649
651
  declare function applyOverrideLists(detected: string[], alwaysCensor: string[], neverCensor: string[]): string[];
650
652
  /**
651
653
  * Applies static find/replace pairs to cue text lines in raw VTT content
652
- * using word-boundary regex. Case-sensitive matching since static replacements
653
- * target specific known strings. Headers, timestamps, and cue identifiers are
654
- * untouched. Returns the edited VTT and the total number of replacements.
654
+ * using word-boundary regex. Defaults to case-sensitive matching since static
655
+ * replacements typically target specific known strings; each entry may opt
656
+ * into case-insensitive matching via `caseSensitive: false`. Headers,
657
+ * timestamps, and cue identifiers are untouched. Returns the edited VTT and
658
+ * the total number of replacements.
655
659
  */
656
660
  declare function applyReplacements(rawVtt: string, replacements: CaptionReplacement[]): {
657
661
  editedVtt: string;
package/dist/index.d.ts CHANGED
@@ -2,14 +2,14 @@ import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresi
2
2
  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-BFYOfBgN.js';
3
3
  import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
4
4
  export { i as primitives } from './index-Drj9Cy_k.js';
5
- export { i as workflows } from './index-BjwbvdoQ.js';
5
+ export { i as workflows } from './index-CwzNfBjV.js';
6
6
  import '@mux/mux-node';
7
7
  import 'zod';
8
8
  import '@ai-sdk/anthropic';
9
9
  import '@ai-sdk/google';
10
10
  import '@ai-sdk/openai';
11
11
 
12
- var version = "0.18.0";
12
+ var version = "0.19.0";
13
13
 
14
14
  type MuxAiErrorType = "validation_error" | "processing_error" | "timeout_error";
15
15
  /**
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // package.json
8
- var version = "0.18.0";
8
+ var version = "0.19.0";
9
9
 
10
10
  // src/lib/prompt-fragments.ts
11
11
  import dedent from "dedent";
@@ -4035,9 +4035,10 @@ function applyReplacements(rawVtt, replacements) {
4035
4035
  const records = [];
4036
4036
  const editedVtt = transformCueText(rawVtt, (line, cueStartTime) => {
4037
4037
  let result = line;
4038
- for (const { find, replace } of filtered) {
4038
+ for (const { find, replace, caseSensitive } of filtered) {
4039
4039
  const escaped = find.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4040
- const regex = new RegExp(`\\b${escaped}\\b`, "g");
4040
+ const flags = caseSensitive === false ? "gi" : "g";
4041
+ const regex = new RegExp(`\\b${escaped}\\b`, flags);
4041
4042
  result = result.replace(regex, (match) => {
4042
4043
  records.push({ cueStartTime, before: match, after: replace });
4043
4044
  return replace;
@@ -4282,13 +4283,13 @@ async function editCaptions(assetId, trackId, options) {
4282
4283
  credentials
4283
4284
  );
4284
4285
  } catch (error) {
4285
- console.warn(`Failed to add track to Mux asset: ${error instanceof Error ? error.message : "Unknown error"}`);
4286
+ wrapError(error, "Failed to add edited track to Mux asset");
4286
4287
  }
4287
4288
  if (deleteOriginal && uploadedTrackId) {
4288
4289
  try {
4289
4290
  await deleteTrackOnMux(assetId, trackId, credentials);
4290
4291
  } catch (error) {
4291
- console.warn(`Failed to delete original track: ${error instanceof Error ? error.message : "Unknown error"}`);
4292
+ wrapError(error, "Failed to delete original track");
4292
4293
  }
4293
4294
  }
4294
4295
  }