@cartesia/cartesia-js 3.0.0-b13 → 3.0.0-b14
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/CHANGELOG.md +4 -0
- package/backcompat/index.d.mts.map +1 -1
- package/backcompat/index.d.ts.map +1 -1
- package/backcompat/index.js +14 -15
- package/backcompat/index.js.map +1 -1
- package/backcompat/index.mjs +14 -15
- package/backcompat/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/backcompat/index.ts +14 -15
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0-b14 (2026-01-23)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v3.0.0-b13...v3.0.0-b14](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b13...v3.0.0-b14)
|
|
6
|
+
|
|
3
7
|
## 3.0.0-b13 (2026-01-21)
|
|
4
8
|
|
|
5
9
|
Full Changelog: [v3.0.0-b12...v3.0.0-b13](https://github.com/cartesia-ai/cartesia-js-internal/compare/v3.0.0-b12...v3.0.0-b13)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OAEvB,KAAK,EAAE,qBAAqB,EAAY;AAuC/C;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAuBhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OAEvB,KAAK,EAAE,qBAAqB,EAAY;AAuC/C;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAW;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,mBAAmB,CAAC;gBAE7B,OAAO,GAAE,qBAA0B;CAuBhD"}
|
package/backcompat/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const client_1 = require("../client.js");
|
|
|
6
6
|
const tts_wrapper_1 = require("./tts-wrapper.js");
|
|
7
7
|
const voices_wrapper_1 = require("./voices-wrapper.js");
|
|
8
8
|
const voice_changer_wrapper_1 = require("./voice-changer-wrapper.js");
|
|
9
|
+
const headers_1 = require("../internal/headers.js");
|
|
9
10
|
async function resolveSupplier(supplier) {
|
|
10
11
|
if (typeof supplier === 'function') {
|
|
11
12
|
return supplier();
|
|
@@ -17,26 +18,24 @@ class DynamicCartesia extends client_1.Cartesia {
|
|
|
17
18
|
super(options);
|
|
18
19
|
this.apiKeySupplier = options.apiKeySupplier;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
validateHeaders(_headers) {
|
|
22
|
+
// Skip validation if we have a dynamic API key supplier
|
|
23
|
+
// The key will be resolved and added in authHeaders
|
|
24
|
+
if (this.apiKeySupplier) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
super.validateHeaders(_headers);
|
|
28
|
+
}
|
|
29
|
+
async authHeaders(opts) {
|
|
30
|
+
// If we have a dynamic supplier, resolve it and return the auth header
|
|
22
31
|
if (this.apiKeySupplier) {
|
|
23
32
|
const key = await resolveSupplier(this.apiKeySupplier);
|
|
24
33
|
if (key) {
|
|
25
|
-
|
|
26
|
-
if (!request.headers) {
|
|
27
|
-
request.headers = { Authorization: authHeader };
|
|
28
|
-
}
|
|
29
|
-
else if (request.headers instanceof Headers) {
|
|
30
|
-
request.headers.set('Authorization', authHeader);
|
|
31
|
-
}
|
|
32
|
-
else if (Array.isArray(request.headers)) {
|
|
33
|
-
request.headers.push(['Authorization', authHeader]);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
request.headers['Authorization'] = authHeader;
|
|
37
|
-
}
|
|
34
|
+
return (0, headers_1.buildHeaders)([{ Authorization: `Bearer ${key}` }]);
|
|
38
35
|
}
|
|
39
36
|
}
|
|
37
|
+
// Otherwise, fall back to default behavior
|
|
38
|
+
return super.authHeaders(opts);
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
/**
|
package/backcompat/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAyD;AACzD,kDAA2C;AAC3C,wDAAiD;AACjD,sEAA8D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":";;;;AAAA,yCAAyD;AACzD,kDAA2C;AAC3C,wDAAiD;AACjD,sEAA8D;AAC9D,oDAAyE;AAGzE,KAAK,UAAU,eAAe,CAAI,QAAqB;IACrD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,OAAQ,QAAiC,EAAE,CAAC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AAG,OAAO,CAAC,OAAiB,CAAC;QACjD,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,WAAqB,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,GAAG,IAAI,wBAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,8BAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,2CAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF;AA7BD,wCA6BC;AAED,2DAA8B;AAC9B,8DAAiC;AACjC,qEAAwC;AACxC,qDAAwB;AACxB,sDAAyB"}
|
package/backcompat/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { Cartesia } from "../client.mjs";
|
|
|
2
2
|
import { TTSWrapper } from "./tts-wrapper.mjs";
|
|
3
3
|
import { VoicesWrapper } from "./voices-wrapper.mjs";
|
|
4
4
|
import { VoiceChangerWrapper } from "./voice-changer-wrapper.mjs";
|
|
5
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
5
6
|
async function resolveSupplier(supplier) {
|
|
6
7
|
if (typeof supplier === 'function') {
|
|
7
8
|
return supplier();
|
|
@@ -13,26 +14,24 @@ class DynamicCartesia extends Cartesia {
|
|
|
13
14
|
super(options);
|
|
14
15
|
this.apiKeySupplier = options.apiKeySupplier;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
validateHeaders(_headers) {
|
|
18
|
+
// Skip validation if we have a dynamic API key supplier
|
|
19
|
+
// The key will be resolved and added in authHeaders
|
|
20
|
+
if (this.apiKeySupplier) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
super.validateHeaders(_headers);
|
|
24
|
+
}
|
|
25
|
+
async authHeaders(opts) {
|
|
26
|
+
// If we have a dynamic supplier, resolve it and return the auth header
|
|
18
27
|
if (this.apiKeySupplier) {
|
|
19
28
|
const key = await resolveSupplier(this.apiKeySupplier);
|
|
20
29
|
if (key) {
|
|
21
|
-
|
|
22
|
-
if (!request.headers) {
|
|
23
|
-
request.headers = { Authorization: authHeader };
|
|
24
|
-
}
|
|
25
|
-
else if (request.headers instanceof Headers) {
|
|
26
|
-
request.headers.set('Authorization', authHeader);
|
|
27
|
-
}
|
|
28
|
-
else if (Array.isArray(request.headers)) {
|
|
29
|
-
request.headers.push(['Authorization', authHeader]);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
request.headers['Authorization'] = authHeader;
|
|
33
|
-
}
|
|
30
|
+
return buildHeaders([{ Authorization: `Bearer ${key}` }]);
|
|
34
31
|
}
|
|
35
32
|
}
|
|
33
|
+
// Otherwise, fall back to default behavior
|
|
34
|
+
return super.authHeaders(opts);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
/**
|
package/backcompat/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OAAO,EAAE,QAAQ,EAAsB;OAChC,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/backcompat/index.ts"],"names":[],"mappings":"OAAO,EAAE,QAAQ,EAAsB;OAChC,EAAE,UAAU,EAAE;OACd,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE;OACvB,EAAE,YAAY,EAAwB;AAG7C,KAAK,UAAU,eAAe,CAAI,QAAqB;IACrD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,OAAQ,QAAiC,EAAE,CA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AAG,OAAO,CAAC,OAAiB,CAAC;QACjD,CAAC;aAAM,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,WAAqB,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,GAAG,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/backcompat/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Cartesia, type ClientOptions } from '../client';
|
|
|
2
2
|
import { TTSWrapper } from './tts-wrapper';
|
|
3
3
|
import { VoicesWrapper } from './voices-wrapper';
|
|
4
4
|
import { VoiceChangerWrapper } from './voice-changer-wrapper';
|
|
5
|
+
import { buildHeaders, type NullableHeaders } from '../internal/headers';
|
|
5
6
|
import type { CartesiaClientOptions, Supplier } from './types';
|
|
6
7
|
|
|
7
8
|
async function resolveSupplier<T>(supplier: Supplier<T>): Promise<T> {
|
|
@@ -19,27 +20,25 @@ class DynamicCartesia extends Cartesia {
|
|
|
19
20
|
this.apiKeySupplier = options.apiKeySupplier;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
protected override
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
protected override validateHeaders(_headers: NullableHeaders): void {
|
|
24
|
+
// Skip validation if we have a dynamic API key supplier
|
|
25
|
+
// The key will be resolved and added in authHeaders
|
|
26
|
+
if (this.apiKeySupplier) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
super.validateHeaders(_headers);
|
|
30
|
+
}
|
|
27
31
|
|
|
32
|
+
protected override async authHeaders(opts: any): Promise<NullableHeaders | undefined> {
|
|
33
|
+
// If we have a dynamic supplier, resolve it and return the auth header
|
|
28
34
|
if (this.apiKeySupplier) {
|
|
29
35
|
const key = await resolveSupplier(this.apiKeySupplier);
|
|
30
36
|
if (key) {
|
|
31
|
-
|
|
32
|
-
if (!request.headers) {
|
|
33
|
-
request.headers = { Authorization: authHeader };
|
|
34
|
-
} else if (request.headers instanceof Headers) {
|
|
35
|
-
request.headers.set('Authorization', authHeader);
|
|
36
|
-
} else if (Array.isArray(request.headers)) {
|
|
37
|
-
request.headers.push(['Authorization', authHeader]);
|
|
38
|
-
} else {
|
|
39
|
-
(request.headers as Record<string, string>)['Authorization'] = authHeader;
|
|
40
|
-
}
|
|
37
|
+
return buildHeaders([{ Authorization: `Bearer ${key}` }]);
|
|
41
38
|
}
|
|
42
39
|
}
|
|
40
|
+
// Otherwise, fall back to default behavior
|
|
41
|
+
return super.authHeaders(opts);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '3.0.0-
|
|
1
|
+
export const VERSION = '3.0.0-b14'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.0-
|
|
1
|
+
export declare const VERSION = "3.0.0-b14";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.0.0-
|
|
1
|
+
export declare const VERSION = "3.0.0-b14";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.0.0-
|
|
1
|
+
export const VERSION = '3.0.0-b14'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|