@elevenlabs/elevenlabs-js 2.25.0 → 2.25.1
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/Client.js +2 -2
- package/dist/Client.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/music.js +34 -3
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/music.js +34 -3
package/Client.js
CHANGED
|
@@ -78,8 +78,8 @@ class ElevenLabsClient {
|
|
|
78
78
|
"xi-api-key": _options === null || _options === void 0 ? void 0 : _options.apiKey,
|
|
79
79
|
"X-Fern-Language": "JavaScript",
|
|
80
80
|
"X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
|
|
81
|
-
"X-Fern-SDK-Version": "v2.25.
|
|
82
|
-
"User-Agent": "@elevenlabs/elevenlabs-js/v2.25.
|
|
81
|
+
"X-Fern-SDK-Version": "v2.25.1",
|
|
82
|
+
"User-Agent": "@elevenlabs/elevenlabs-js/v2.25.1",
|
|
83
83
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
84
84
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
85
85
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
package/dist/Client.js
CHANGED
|
@@ -78,8 +78,8 @@ class ElevenLabsClient {
|
|
|
78
78
|
"xi-api-key": _options === null || _options === void 0 ? void 0 : _options.apiKey,
|
|
79
79
|
"X-Fern-Language": "JavaScript",
|
|
80
80
|
"X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
|
|
81
|
-
"X-Fern-SDK-Version": "v2.25.
|
|
82
|
-
"User-Agent": "@elevenlabs/elevenlabs-js/v2.25.
|
|
81
|
+
"X-Fern-SDK-Version": "v2.25.1",
|
|
82
|
+
"User-Agent": "@elevenlabs/elevenlabs-js/v2.25.1",
|
|
83
83
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
84
84
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
85
85
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.25.
|
|
1
|
+
export declare const SDK_VERSION = "v2.25.1";
|
package/dist/version.js
CHANGED
package/dist/wrapper/music.js
CHANGED
|
@@ -135,7 +135,9 @@ class Music {
|
|
|
135
135
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
136
136
|
// Call the base client method to get the stream with raw response
|
|
137
137
|
try {
|
|
138
|
-
const { data: stream, rawResponse } = yield this._client
|
|
138
|
+
const { data: stream, rawResponse } = yield this._client
|
|
139
|
+
.composeDetailed(request, requestOptions)
|
|
140
|
+
.withRawResponse();
|
|
139
141
|
// Parse the stream using the existing parsing method
|
|
140
142
|
const parsedResponse = yield this.parseMultipart(stream);
|
|
141
143
|
return { data: parsedResponse, rawResponse };
|
|
@@ -275,8 +277,37 @@ class Music {
|
|
|
275
277
|
}
|
|
276
278
|
audioStart++;
|
|
277
279
|
}
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
+
// Find the closing boundary to properly terminate the audio data
|
|
281
|
+
// Multipart responses end with: \r\n--boundary--\r\n or \n--boundary--\n
|
|
282
|
+
// Try \r\n first (HTTP standard), then fall back to \n
|
|
283
|
+
const closingBoundaryCRLF = new TextEncoder().encode("\r\n" + boundary + "--");
|
|
284
|
+
const closingBoundaryLF = new TextEncoder().encode("\n" + boundary + "--");
|
|
285
|
+
let audioEnd = responseBytes.length;
|
|
286
|
+
// Helper to find boundary pattern in response bytes
|
|
287
|
+
const findBoundary = (pattern) => {
|
|
288
|
+
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
289
|
+
let match = true;
|
|
290
|
+
for (let j = 0; j < pattern.length; j++) {
|
|
291
|
+
if (responseBytes[i + j] !== pattern[j]) {
|
|
292
|
+
match = false;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (match) {
|
|
297
|
+
return i;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return -1;
|
|
301
|
+
};
|
|
302
|
+
// Try CRLF first, then LF
|
|
303
|
+
let foundAt = findBoundary(closingBoundaryCRLF);
|
|
304
|
+
if (foundAt === -1) {
|
|
305
|
+
foundAt = findBoundary(closingBoundaryLF);
|
|
306
|
+
}
|
|
307
|
+
if (foundAt !== -1) {
|
|
308
|
+
audioEnd = foundAt;
|
|
309
|
+
}
|
|
310
|
+
const audioBuffer = Buffer.from(responseBytes.slice(audioStart, audioEnd));
|
|
280
311
|
if (!jsonData) {
|
|
281
312
|
throw new Error("Could not parse JSON data");
|
|
282
313
|
}
|
package/package.json
CHANGED
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.25.
|
|
1
|
+
export declare const SDK_VERSION = "v2.25.1";
|
package/version.js
CHANGED
package/wrapper/music.js
CHANGED
|
@@ -135,7 +135,9 @@ class Music {
|
|
|
135
135
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
136
136
|
// Call the base client method to get the stream with raw response
|
|
137
137
|
try {
|
|
138
|
-
const { data: stream, rawResponse } = yield this._client
|
|
138
|
+
const { data: stream, rawResponse } = yield this._client
|
|
139
|
+
.composeDetailed(request, requestOptions)
|
|
140
|
+
.withRawResponse();
|
|
139
141
|
// Parse the stream using the existing parsing method
|
|
140
142
|
const parsedResponse = yield this.parseMultipart(stream);
|
|
141
143
|
return { data: parsedResponse, rawResponse };
|
|
@@ -275,8 +277,37 @@ class Music {
|
|
|
275
277
|
}
|
|
276
278
|
audioStart++;
|
|
277
279
|
}
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
+
// Find the closing boundary to properly terminate the audio data
|
|
281
|
+
// Multipart responses end with: \r\n--boundary--\r\n or \n--boundary--\n
|
|
282
|
+
// Try \r\n first (HTTP standard), then fall back to \n
|
|
283
|
+
const closingBoundaryCRLF = new TextEncoder().encode("\r\n" + boundary + "--");
|
|
284
|
+
const closingBoundaryLF = new TextEncoder().encode("\n" + boundary + "--");
|
|
285
|
+
let audioEnd = responseBytes.length;
|
|
286
|
+
// Helper to find boundary pattern in response bytes
|
|
287
|
+
const findBoundary = (pattern) => {
|
|
288
|
+
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
289
|
+
let match = true;
|
|
290
|
+
for (let j = 0; j < pattern.length; j++) {
|
|
291
|
+
if (responseBytes[i + j] !== pattern[j]) {
|
|
292
|
+
match = false;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (match) {
|
|
297
|
+
return i;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return -1;
|
|
301
|
+
};
|
|
302
|
+
// Try CRLF first, then LF
|
|
303
|
+
let foundAt = findBoundary(closingBoundaryCRLF);
|
|
304
|
+
if (foundAt === -1) {
|
|
305
|
+
foundAt = findBoundary(closingBoundaryLF);
|
|
306
|
+
}
|
|
307
|
+
if (foundAt !== -1) {
|
|
308
|
+
audioEnd = foundAt;
|
|
309
|
+
}
|
|
310
|
+
const audioBuffer = Buffer.from(responseBytes.slice(audioStart, audioEnd));
|
|
280
311
|
if (!jsonData) {
|
|
281
312
|
throw new Error("Could not parse JSON data");
|
|
282
313
|
}
|