modelfusion 0.41.2 → 0.41.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modelfusion",
3
3
  "description": "Build multimodal applications, chatbots, and agents with JavaScript and TypeScript.",
4
- "version": "0.41.2",
4
+ "version": "0.41.3",
5
5
  "author": "Lars Grammel",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAudioFileExtension = void 0;
4
+ function getAudioFileExtension(mimeType) {
5
+ const normalizedMimeType = mimeType.split(";")[0].toLowerCase();
6
+ switch (normalizedMimeType) {
7
+ case "audio/webm":
8
+ return "webm";
9
+ case "audio/mp3":
10
+ return "mp3";
11
+ case "audio/wav":
12
+ return "wav";
13
+ case "audio/mp4":
14
+ return "mp4";
15
+ case "audio/mpeg":
16
+ case "audio/mpga":
17
+ return "mpeg";
18
+ case "audio/ogg":
19
+ case "audio/oga":
20
+ return "ogg";
21
+ case "audio/flac":
22
+ return "flac";
23
+ case "audio/m4a":
24
+ return "m4a";
25
+ default:
26
+ throw new Error(`Unsupported audio format: ${mimeType}`);
27
+ }
28
+ }
29
+ exports.getAudioFileExtension = getAudioFileExtension;
@@ -0,0 +1 @@
1
+ export declare function getAudioFileExtension(mimeType: string): "mp3" | "flac" | "m4a" | "mp4" | "mpeg" | "ogg" | "wav" | "webm";
@@ -0,0 +1,25 @@
1
+ export function getAudioFileExtension(mimeType) {
2
+ const normalizedMimeType = mimeType.split(";")[0].toLowerCase();
3
+ switch (normalizedMimeType) {
4
+ case "audio/webm":
5
+ return "webm";
6
+ case "audio/mp3":
7
+ return "mp3";
8
+ case "audio/wav":
9
+ return "wav";
10
+ case "audio/mp4":
11
+ return "mp4";
12
+ case "audio/mpeg":
13
+ case "audio/mpga":
14
+ return "mpeg";
15
+ case "audio/ogg":
16
+ case "audio/oga":
17
+ return "ogg";
18
+ case "audio/flac":
19
+ return "flac";
20
+ case "audio/m4a":
21
+ return "m4a";
22
+ default:
23
+ throw new Error(`Unsupported audio format: ${mimeType}`);
24
+ }
25
+ }
package/util/index.cjs CHANGED
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cosineSimilarity.cjs"), exports);
18
+ __exportStar(require("./getAudioFileExtension.cjs"), exports);
package/util/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./cosineSimilarity.js";
2
+ export * from "./getAudioFileExtension.js";
package/util/index.js CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./cosineSimilarity.js";
2
+ export * from "./getAudioFileExtension.js";