@elevenlabs/elevenlabs-js 2.38.0 → 2.38.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/BaseClient.js +2 -2
- package/dist/BaseClient.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/music.d.ts +3 -1
- package/dist/wrapper/music.js +29 -27
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/music.d.ts +3 -1
- package/wrapper/music.js +29 -27
package/BaseClient.js
CHANGED
|
@@ -41,8 +41,8 @@ function normalizeClientOptions(options) {
|
|
|
41
41
|
const headers = (0, headers_1.mergeHeaders)({
|
|
42
42
|
"X-Fern-Language": "JavaScript",
|
|
43
43
|
"X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
|
|
44
|
-
"X-Fern-SDK-Version": "v2.38.
|
|
45
|
-
"User-Agent": "@elevenlabs/elevenlabs-js/v2.38.
|
|
44
|
+
"X-Fern-SDK-Version": "v2.38.1",
|
|
45
|
+
"User-Agent": "@elevenlabs/elevenlabs-js/v2.38.1",
|
|
46
46
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
47
47
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
48
48
|
"xi-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
|
package/dist/BaseClient.js
CHANGED
|
@@ -41,8 +41,8 @@ function normalizeClientOptions(options) {
|
|
|
41
41
|
const headers = (0, headers_1.mergeHeaders)({
|
|
42
42
|
"X-Fern-Language": "JavaScript",
|
|
43
43
|
"X-Fern-SDK-Name": "@elevenlabs/elevenlabs-js",
|
|
44
|
-
"X-Fern-SDK-Version": "v2.38.
|
|
45
|
-
"User-Agent": "@elevenlabs/elevenlabs-js/v2.38.
|
|
44
|
+
"X-Fern-SDK-Version": "v2.38.1",
|
|
45
|
+
"User-Agent": "@elevenlabs/elevenlabs-js/v2.38.1",
|
|
46
46
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
47
47
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
48
48
|
"xi-api-key": options === null || options === void 0 ? void 0 : options.apiKey,
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.38.
|
|
1
|
+
export declare const SDK_VERSION = "v2.38.1";
|
package/dist/version.js
CHANGED
package/dist/wrapper/music.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type * as ElevenLabs from "../api";
|
|
1
2
|
import { MusicClient as GeneratedMusic } from "../api/resources/music/client/Client";
|
|
2
3
|
import { CompositionPlanClient } from "../api/resources/music/resources/compositionPlan/client/Client";
|
|
3
|
-
import type * as ElevenLabs from "../api";
|
|
4
4
|
import * as core from "../core";
|
|
5
5
|
export declare namespace Music {
|
|
6
6
|
interface Options extends GeneratedMusic.Options {
|
|
@@ -123,4 +123,6 @@ export declare class Music {
|
|
|
123
123
|
* Converts snake_case keys to camelCase recursively
|
|
124
124
|
*/
|
|
125
125
|
private toCamelCase;
|
|
126
|
+
private findIndex;
|
|
127
|
+
private findAudioStartIndex;
|
|
126
128
|
}
|
package/dist/wrapper/music.js
CHANGED
|
@@ -271,41 +271,17 @@ class Music {
|
|
|
271
271
|
}
|
|
272
272
|
// Find the start of audio data (after headers and empty line)
|
|
273
273
|
let audioStart = secondBoundary + boundaryBytes.length;
|
|
274
|
-
|
|
275
|
-
while (audioStart < responseBytes.length - 1) {
|
|
276
|
-
if (responseBytes[audioStart] === 0x0a && responseBytes[audioStart + 1] === 0x0a) {
|
|
277
|
-
// Found \n\n - audio starts after this
|
|
278
|
-
audioStart += 2;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
audioStart++;
|
|
282
|
-
}
|
|
274
|
+
audioStart = this.findAudioStartIndex(responseBytes, audioStart);
|
|
283
275
|
// Find the closing boundary to properly terminate the audio data
|
|
284
276
|
// Multipart responses end with: \r\n--boundary--\r\n or \n--boundary--\n
|
|
285
277
|
// Try \r\n first (HTTP standard), then fall back to \n
|
|
286
278
|
const closingBoundaryCRLF = new TextEncoder().encode("\r\n" + boundary + "--");
|
|
287
279
|
const closingBoundaryLF = new TextEncoder().encode("\n" + boundary + "--");
|
|
288
280
|
let audioEnd = responseBytes.length;
|
|
289
|
-
// Helper to find boundary pattern in response bytes
|
|
290
|
-
const findBoundary = (pattern) => {
|
|
291
|
-
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
292
|
-
let match = true;
|
|
293
|
-
for (let j = 0; j < pattern.length; j++) {
|
|
294
|
-
if (responseBytes[i + j] !== pattern[j]) {
|
|
295
|
-
match = false;
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (match) {
|
|
300
|
-
return i;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return -1;
|
|
304
|
-
};
|
|
305
281
|
// Try CRLF first, then LF
|
|
306
|
-
let foundAt =
|
|
282
|
+
let foundAt = this.findIndex(responseBytes, audioStart, closingBoundaryCRLF);
|
|
307
283
|
if (foundAt === -1) {
|
|
308
|
-
foundAt =
|
|
284
|
+
foundAt = this.findIndex(responseBytes, audioStart, closingBoundaryLF);
|
|
309
285
|
}
|
|
310
286
|
if (foundAt !== -1) {
|
|
311
287
|
audioEnd = foundAt;
|
|
@@ -337,5 +313,31 @@ class Music {
|
|
|
337
313
|
}
|
|
338
314
|
return obj;
|
|
339
315
|
}
|
|
316
|
+
findIndex(responseBytes, audioStart, pattern) {
|
|
317
|
+
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
318
|
+
let match = true;
|
|
319
|
+
for (let j = 0; j < pattern.length; j++) {
|
|
320
|
+
if (responseBytes[i + j] !== pattern[j]) {
|
|
321
|
+
match = false;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (match) {
|
|
326
|
+
return i;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return -1;
|
|
330
|
+
}
|
|
331
|
+
findAudioStartIndex(responseBytes, startIndex) {
|
|
332
|
+
const foundAtCRLF = this.findIndex(responseBytes, startIndex, new TextEncoder().encode("\r\n\r\n"));
|
|
333
|
+
if (foundAtCRLF !== -1) {
|
|
334
|
+
return foundAtCRLF + 4;
|
|
335
|
+
}
|
|
336
|
+
const foundAtLF = this.findIndex(responseBytes, startIndex, new TextEncoder().encode("\n\n"));
|
|
337
|
+
if (foundAtLF !== -1) {
|
|
338
|
+
return foundAtLF + 2;
|
|
339
|
+
}
|
|
340
|
+
throw new Error("Could not find body start index");
|
|
341
|
+
}
|
|
340
342
|
}
|
|
341
343
|
exports.Music = Music;
|
package/package.json
CHANGED
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "v2.38.
|
|
1
|
+
export declare const SDK_VERSION = "v2.38.1";
|
package/version.js
CHANGED
package/wrapper/music.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type * as ElevenLabs from "../api";
|
|
1
2
|
import { MusicClient as GeneratedMusic } from "../api/resources/music/client/Client";
|
|
2
3
|
import { CompositionPlanClient } from "../api/resources/music/resources/compositionPlan/client/Client";
|
|
3
|
-
import type * as ElevenLabs from "../api";
|
|
4
4
|
import * as core from "../core";
|
|
5
5
|
export declare namespace Music {
|
|
6
6
|
interface Options extends GeneratedMusic.Options {
|
|
@@ -123,4 +123,6 @@ export declare class Music {
|
|
|
123
123
|
* Converts snake_case keys to camelCase recursively
|
|
124
124
|
*/
|
|
125
125
|
private toCamelCase;
|
|
126
|
+
private findIndex;
|
|
127
|
+
private findAudioStartIndex;
|
|
126
128
|
}
|
package/wrapper/music.js
CHANGED
|
@@ -271,41 +271,17 @@ class Music {
|
|
|
271
271
|
}
|
|
272
272
|
// Find the start of audio data (after headers and empty line)
|
|
273
273
|
let audioStart = secondBoundary + boundaryBytes.length;
|
|
274
|
-
|
|
275
|
-
while (audioStart < responseBytes.length - 1) {
|
|
276
|
-
if (responseBytes[audioStart] === 0x0a && responseBytes[audioStart + 1] === 0x0a) {
|
|
277
|
-
// Found \n\n - audio starts after this
|
|
278
|
-
audioStart += 2;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
audioStart++;
|
|
282
|
-
}
|
|
274
|
+
audioStart = this.findAudioStartIndex(responseBytes, audioStart);
|
|
283
275
|
// Find the closing boundary to properly terminate the audio data
|
|
284
276
|
// Multipart responses end with: \r\n--boundary--\r\n or \n--boundary--\n
|
|
285
277
|
// Try \r\n first (HTTP standard), then fall back to \n
|
|
286
278
|
const closingBoundaryCRLF = new TextEncoder().encode("\r\n" + boundary + "--");
|
|
287
279
|
const closingBoundaryLF = new TextEncoder().encode("\n" + boundary + "--");
|
|
288
280
|
let audioEnd = responseBytes.length;
|
|
289
|
-
// Helper to find boundary pattern in response bytes
|
|
290
|
-
const findBoundary = (pattern) => {
|
|
291
|
-
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
292
|
-
let match = true;
|
|
293
|
-
for (let j = 0; j < pattern.length; j++) {
|
|
294
|
-
if (responseBytes[i + j] !== pattern[j]) {
|
|
295
|
-
match = false;
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
if (match) {
|
|
300
|
-
return i;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return -1;
|
|
304
|
-
};
|
|
305
281
|
// Try CRLF first, then LF
|
|
306
|
-
let foundAt =
|
|
282
|
+
let foundAt = this.findIndex(responseBytes, audioStart, closingBoundaryCRLF);
|
|
307
283
|
if (foundAt === -1) {
|
|
308
|
-
foundAt =
|
|
284
|
+
foundAt = this.findIndex(responseBytes, audioStart, closingBoundaryLF);
|
|
309
285
|
}
|
|
310
286
|
if (foundAt !== -1) {
|
|
311
287
|
audioEnd = foundAt;
|
|
@@ -337,5 +313,31 @@ class Music {
|
|
|
337
313
|
}
|
|
338
314
|
return obj;
|
|
339
315
|
}
|
|
316
|
+
findIndex(responseBytes, audioStart, pattern) {
|
|
317
|
+
for (let i = audioStart; i <= responseBytes.length - pattern.length; i++) {
|
|
318
|
+
let match = true;
|
|
319
|
+
for (let j = 0; j < pattern.length; j++) {
|
|
320
|
+
if (responseBytes[i + j] !== pattern[j]) {
|
|
321
|
+
match = false;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (match) {
|
|
326
|
+
return i;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return -1;
|
|
330
|
+
}
|
|
331
|
+
findAudioStartIndex(responseBytes, startIndex) {
|
|
332
|
+
const foundAtCRLF = this.findIndex(responseBytes, startIndex, new TextEncoder().encode("\r\n\r\n"));
|
|
333
|
+
if (foundAtCRLF !== -1) {
|
|
334
|
+
return foundAtCRLF + 4;
|
|
335
|
+
}
|
|
336
|
+
const foundAtLF = this.findIndex(responseBytes, startIndex, new TextEncoder().encode("\n\n"));
|
|
337
|
+
if (foundAtLF !== -1) {
|
|
338
|
+
return foundAtLF + 2;
|
|
339
|
+
}
|
|
340
|
+
throw new Error("Could not find body start index");
|
|
341
|
+
}
|
|
340
342
|
}
|
|
341
343
|
exports.Music = Music;
|