@cartesia/cartesia-js 2.2.3 → 2.2.4
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/README.md +58 -7
- package/api/resources/apiStatus/client/Client.js +1 -1
- package/api/resources/auth/client/Client.js +1 -1
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/infill/client/Client.js +1 -1
- package/api/resources/stt/client/Client.d.ts +28 -0
- package/api/resources/stt/client/Client.js +58 -0
- package/api/resources/stt/client/index.d.ts +1 -0
- package/api/resources/stt/client/index.js +5 -0
- package/api/resources/stt/index.d.ts +1 -0
- package/api/resources/stt/index.js +17 -0
- package/api/resources/stt/types/DoneMessage.d.ts +10 -0
- package/api/resources/stt/types/DoneMessage.js +5 -0
- package/api/resources/stt/types/ErrorMessage.d.ts +9 -0
- package/api/resources/stt/types/ErrorMessage.js +5 -0
- package/api/resources/stt/types/FlushDoneMessage.d.ts +10 -0
- package/api/resources/stt/types/FlushDoneMessage.js +5 -0
- package/api/resources/stt/types/StreamingTranscriptionResponse.d.ts +22 -0
- package/api/resources/stt/types/StreamingTranscriptionResponse.js +5 -0
- package/api/resources/stt/types/SttEncoding.d.ts +15 -0
- package/api/resources/stt/types/SttEncoding.js +9 -0
- package/api/resources/stt/types/TranscriptMessage.d.ts +19 -0
- package/api/resources/stt/types/TranscriptMessage.js +5 -0
- package/api/resources/stt/types/TranscriptionResponse.d.ts +11 -0
- package/api/resources/stt/types/TranscriptionResponse.js +5 -0
- package/api/resources/stt/types/index.d.ts +7 -0
- package/api/resources/stt/types/index.js +23 -0
- package/api/resources/voices/client/Client.js +8 -8
- package/dist/api/resources/apiStatus/client/Client.js +1 -1
- package/dist/api/resources/auth/client/Client.js +1 -1
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/infill/client/Client.js +1 -1
- package/dist/api/resources/stt/client/Client.d.ts +28 -0
- package/dist/api/resources/stt/client/Client.js +58 -0
- package/dist/api/resources/stt/client/index.d.ts +1 -0
- package/dist/api/resources/stt/client/index.js +5 -0
- package/dist/api/resources/stt/index.d.ts +1 -0
- package/dist/api/resources/stt/index.js +17 -0
- package/dist/api/resources/stt/types/DoneMessage.d.ts +10 -0
- package/dist/api/resources/stt/types/DoneMessage.js +5 -0
- package/dist/api/resources/stt/types/ErrorMessage.d.ts +9 -0
- package/dist/api/resources/stt/types/ErrorMessage.js +5 -0
- package/dist/api/resources/stt/types/FlushDoneMessage.d.ts +10 -0
- package/dist/api/resources/stt/types/FlushDoneMessage.js +5 -0
- package/dist/api/resources/stt/types/StreamingTranscriptionResponse.d.ts +22 -0
- package/dist/api/resources/stt/types/StreamingTranscriptionResponse.js +5 -0
- package/dist/api/resources/stt/types/SttEncoding.d.ts +15 -0
- package/dist/api/resources/stt/types/SttEncoding.js +9 -0
- package/dist/api/resources/stt/types/TranscriptMessage.d.ts +19 -0
- package/dist/api/resources/stt/types/TranscriptMessage.js +5 -0
- package/dist/api/resources/stt/types/TranscriptionResponse.d.ts +11 -0
- package/dist/api/resources/stt/types/TranscriptionResponse.js +5 -0
- package/dist/api/resources/stt/types/index.d.ts +7 -0
- package/dist/api/resources/stt/types/index.js +23 -0
- package/dist/api/resources/voices/client/Client.js +8 -8
- package/dist/serialization/resources/index.d.ts +2 -0
- package/dist/serialization/resources/index.js +3 -1
- package/dist/serialization/resources/stt/index.d.ts +1 -0
- package/dist/serialization/resources/stt/index.js +17 -0
- package/dist/serialization/resources/stt/types/DoneMessage.d.ts +12 -0
- package/dist/serialization/resources/stt/types/DoneMessage.js +43 -0
- package/dist/serialization/resources/stt/types/ErrorMessage.d.ts +13 -0
- package/dist/serialization/resources/stt/types/ErrorMessage.js +44 -0
- package/dist/serialization/resources/stt/types/FlushDoneMessage.d.ts +12 -0
- package/dist/serialization/resources/stt/types/FlushDoneMessage.js +43 -0
- package/dist/serialization/resources/stt/types/StreamingTranscriptionResponse.d.ts +26 -0
- package/dist/serialization/resources/stt/types/StreamingTranscriptionResponse.js +55 -0
- package/dist/serialization/resources/stt/types/SttEncoding.d.ts +10 -0
- package/dist/serialization/resources/stt/types/SttEncoding.js +41 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.d.ts +16 -0
- package/dist/serialization/resources/stt/types/TranscriptMessage.js +47 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.d.ts +14 -0
- package/dist/serialization/resources/stt/types/TranscriptionResponse.js +45 -0
- package/dist/serialization/resources/stt/types/index.d.ts +7 -0
- package/dist/serialization/resources/stt/types/index.js +23 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wrapper/Client.d.ts +3 -0
- package/dist/wrapper/Client.js +5 -0
- package/dist/wrapper/StreamingSTTClient.d.ts +6 -0
- package/dist/wrapper/StreamingSTTClient.js +17 -0
- package/dist/wrapper/SttWebsocket.d.ts +29 -0
- package/dist/wrapper/SttWebsocket.js +198 -0
- package/dist/wrapper/Websocket.d.ts +1 -1
- package/dist/wrapper/Websocket.js +24 -16
- package/package.json +1 -1
- package/serialization/resources/index.d.ts +2 -0
- package/serialization/resources/index.js +3 -1
- package/serialization/resources/stt/index.d.ts +1 -0
- package/serialization/resources/stt/index.js +17 -0
- package/serialization/resources/stt/types/DoneMessage.d.ts +12 -0
- package/serialization/resources/stt/types/DoneMessage.js +43 -0
- package/serialization/resources/stt/types/ErrorMessage.d.ts +13 -0
- package/serialization/resources/stt/types/ErrorMessage.js +44 -0
- package/serialization/resources/stt/types/FlushDoneMessage.d.ts +12 -0
- package/serialization/resources/stt/types/FlushDoneMessage.js +43 -0
- package/serialization/resources/stt/types/StreamingTranscriptionResponse.d.ts +26 -0
- package/serialization/resources/stt/types/StreamingTranscriptionResponse.js +55 -0
- package/serialization/resources/stt/types/SttEncoding.d.ts +10 -0
- package/serialization/resources/stt/types/SttEncoding.js +41 -0
- package/serialization/resources/stt/types/TranscriptMessage.d.ts +16 -0
- package/serialization/resources/stt/types/TranscriptMessage.js +47 -0
- package/serialization/resources/stt/types/TranscriptionResponse.d.ts +14 -0
- package/serialization/resources/stt/types/TranscriptionResponse.js +45 -0
- package/serialization/resources/stt/types/index.d.ts +7 -0
- package/serialization/resources/stt/types/index.js +23 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/wrapper/Client.d.ts +3 -0
- package/wrapper/Client.js +5 -0
- package/wrapper/StreamingSTTClient.d.ts +6 -0
- package/wrapper/StreamingSTTClient.js +17 -0
- package/wrapper/SttWebsocket.d.ts +29 -0
- package/wrapper/SttWebsocket.js +198 -0
- package/wrapper/Websocket.d.ts +1 -1
- package/wrapper/Websocket.js +24 -16
|
@@ -55,7 +55,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
55
55
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
56
56
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
57
|
};
|
|
58
|
-
var _Websocket_instances, _Websocket_isConnected, _Websocket_sampleRate, _Websocket_container, _Websocket_encoding, _Websocket_generateId;
|
|
58
|
+
var _Websocket_instances, _Websocket_isConnected, _Websocket_sampleRate, _Websocket_container, _Websocket_encoding, _Websocket_connectionPromise, _Websocket_ensureConnected, _Websocket_generateId;
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
60
|
const core = __importStar(require("../core"));
|
|
61
61
|
const environments = __importStar(require("../environments"));
|
|
@@ -74,6 +74,7 @@ class Websocket {
|
|
|
74
74
|
_Websocket_sampleRate.set(this, void 0);
|
|
75
75
|
_Websocket_container.set(this, void 0);
|
|
76
76
|
_Websocket_encoding.set(this, void 0);
|
|
77
|
+
_Websocket_connectionPromise.set(this, void 0);
|
|
77
78
|
__classPrivateFieldSet(this, _Websocket_sampleRate, sampleRate, "f");
|
|
78
79
|
__classPrivateFieldSet(this, _Websocket_container, container !== null && container !== void 0 ? container : "raw", "f");
|
|
79
80
|
__classPrivateFieldSet(this, _Websocket_encoding, encoding !== null && encoding !== void 0 ? encoding : "pcm_f32le", "f");
|
|
@@ -91,9 +92,7 @@ class Websocket {
|
|
|
91
92
|
send(inputs_1) {
|
|
92
93
|
return __awaiter(this, arguments, void 0, function* (inputs, { timeout = 0 } = {}) {
|
|
93
94
|
var _a, _b, _c, _d;
|
|
94
|
-
|
|
95
|
-
throw new Error("Not connected to WebSocket. Call .connect() first.");
|
|
96
|
-
}
|
|
95
|
+
yield __classPrivateFieldGet(this, _Websocket_instances, "m", _Websocket_ensureConnected).call(this);
|
|
97
96
|
if (!inputs.contextId) {
|
|
98
97
|
inputs.contextId = __classPrivateFieldGet(this, _Websocket_instances, "m", _Websocket_generateId).call(this);
|
|
99
98
|
}
|
|
@@ -153,17 +152,17 @@ class Websocket {
|
|
|
153
152
|
});
|
|
154
153
|
}
|
|
155
154
|
continue(inputs) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
var _a;
|
|
157
|
+
yield __classPrivateFieldGet(this, _Websocket_instances, "m", _Websocket_ensureConnected).call(this);
|
|
158
|
+
if (!inputs.contextId) {
|
|
159
|
+
throw new Error("context_id is required to continue a context.");
|
|
160
|
+
}
|
|
161
|
+
if (!inputs.outputFormat) {
|
|
162
|
+
inputs.outputFormat = (0, utils_1.resolveOutputFormat)(__classPrivateFieldGet(this, _Websocket_container, "f"), __classPrivateFieldGet(this, _Websocket_encoding, "f"), __classPrivateFieldGet(this, _Websocket_sampleRate, "f"));
|
|
163
|
+
}
|
|
164
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(Object.assign({ continue: true }, serializers.WebSocketTtsRequest.jsonOrThrow(inputs, { unrecognizedObjectKeys: "strip" }))));
|
|
165
|
+
});
|
|
167
166
|
}
|
|
168
167
|
/**
|
|
169
168
|
* Authenticate and connect to a Cartesia streaming WebSocket.
|
|
@@ -226,7 +225,16 @@ class Websocket {
|
|
|
226
225
|
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
227
226
|
}
|
|
228
227
|
}
|
|
229
|
-
_Websocket_isConnected = new WeakMap(), _Websocket_sampleRate = new WeakMap(), _Websocket_container = new WeakMap(), _Websocket_encoding = new WeakMap(), _Websocket_instances = new WeakSet(),
|
|
228
|
+
_Websocket_isConnected = new WeakMap(), _Websocket_sampleRate = new WeakMap(), _Websocket_container = new WeakMap(), _Websocket_encoding = new WeakMap(), _Websocket_connectionPromise = new WeakMap(), _Websocket_instances = new WeakSet(), _Websocket_ensureConnected = function _Websocket_ensureConnected() {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
if (__classPrivateFieldGet(this, _Websocket_isConnected, "f"))
|
|
231
|
+
return;
|
|
232
|
+
if (!__classPrivateFieldGet(this, _Websocket_connectionPromise, "f")) {
|
|
233
|
+
__classPrivateFieldSet(this, _Websocket_connectionPromise, this.connect(), "f");
|
|
234
|
+
}
|
|
235
|
+
yield __classPrivateFieldGet(this, _Websocket_connectionPromise, "f");
|
|
236
|
+
});
|
|
237
|
+
}, _Websocket_generateId = function _Websocket_generateId() {
|
|
230
238
|
return (0, human_id_1.humanId)({
|
|
231
239
|
separator: "-",
|
|
232
240
|
capitalize: false,
|
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@ export * as auth from "./auth";
|
|
|
4
4
|
export * from "./auth/types";
|
|
5
5
|
export * as embedding from "./embedding";
|
|
6
6
|
export * from "./embedding/types";
|
|
7
|
+
export * as stt from "./stt";
|
|
8
|
+
export * from "./stt/types";
|
|
7
9
|
export * as tts from "./tts";
|
|
8
10
|
export * from "./tts/types";
|
|
9
11
|
export * as voiceChanger from "./voiceChanger";
|
|
@@ -36,13 +36,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.voices = exports.voiceChanger = exports.tts = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
39
|
+
exports.voices = exports.voiceChanger = exports.tts = exports.stt = exports.embedding = exports.auth = exports.apiStatus = void 0;
|
|
40
40
|
exports.apiStatus = __importStar(require("./apiStatus"));
|
|
41
41
|
__exportStar(require("./apiStatus/types"), exports);
|
|
42
42
|
exports.auth = __importStar(require("./auth"));
|
|
43
43
|
__exportStar(require("./auth/types"), exports);
|
|
44
44
|
exports.embedding = __importStar(require("./embedding"));
|
|
45
45
|
__exportStar(require("./embedding/types"), exports);
|
|
46
|
+
exports.stt = __importStar(require("./stt"));
|
|
47
|
+
__exportStar(require("./stt/types"), exports);
|
|
46
48
|
exports.tts = __importStar(require("./tts"));
|
|
47
49
|
__exportStar(require("./tts/types"), exports);
|
|
48
50
|
exports.voiceChanger = __importStar(require("./voiceChanger"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const DoneMessage: core.serialization.ObjectSchema<serializers.DoneMessage.Raw, Cartesia.DoneMessage>;
|
|
8
|
+
export declare namespace DoneMessage {
|
|
9
|
+
interface Raw {
|
|
10
|
+
request_id: string;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.DoneMessage = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.DoneMessage = core.serialization.object({
|
|
42
|
+
requestId: core.serialization.property("request_id", core.serialization.string()),
|
|
43
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const ErrorMessage: core.serialization.ObjectSchema<serializers.ErrorMessage.Raw, Cartesia.ErrorMessage>;
|
|
8
|
+
export declare namespace ErrorMessage {
|
|
9
|
+
interface Raw {
|
|
10
|
+
request_id?: string | null;
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.ErrorMessage = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.ErrorMessage = core.serialization.object({
|
|
42
|
+
requestId: core.serialization.property("request_id", core.serialization.string().optional()),
|
|
43
|
+
message: core.serialization.string(),
|
|
44
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const FlushDoneMessage: core.serialization.ObjectSchema<serializers.FlushDoneMessage.Raw, Cartesia.FlushDoneMessage>;
|
|
8
|
+
export declare namespace FlushDoneMessage {
|
|
9
|
+
interface Raw {
|
|
10
|
+
request_id: string;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.FlushDoneMessage = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.FlushDoneMessage = core.serialization.object({
|
|
42
|
+
requestId: core.serialization.property("request_id", core.serialization.string()),
|
|
43
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
import { TranscriptMessage } from "./TranscriptMessage";
|
|
8
|
+
import { FlushDoneMessage } from "./FlushDoneMessage";
|
|
9
|
+
import { DoneMessage } from "./DoneMessage";
|
|
10
|
+
import { ErrorMessage } from "./ErrorMessage";
|
|
11
|
+
export declare const StreamingTranscriptionResponse: core.serialization.Schema<serializers.StreamingTranscriptionResponse.Raw, Cartesia.StreamingTranscriptionResponse>;
|
|
12
|
+
export declare namespace StreamingTranscriptionResponse {
|
|
13
|
+
type Raw = StreamingTranscriptionResponse.Transcript | StreamingTranscriptionResponse.FlushDone | StreamingTranscriptionResponse.Done | StreamingTranscriptionResponse.Error;
|
|
14
|
+
interface Transcript extends TranscriptMessage.Raw {
|
|
15
|
+
type: "transcript";
|
|
16
|
+
}
|
|
17
|
+
interface FlushDone extends FlushDoneMessage.Raw {
|
|
18
|
+
type: "flush_done";
|
|
19
|
+
}
|
|
20
|
+
interface Done extends DoneMessage.Raw {
|
|
21
|
+
type: "done";
|
|
22
|
+
}
|
|
23
|
+
interface Error extends ErrorMessage.Raw {
|
|
24
|
+
type: "error";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.StreamingTranscriptionResponse = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
const TranscriptMessage_1 = require("./TranscriptMessage");
|
|
42
|
+
const FlushDoneMessage_1 = require("./FlushDoneMessage");
|
|
43
|
+
const DoneMessage_1 = require("./DoneMessage");
|
|
44
|
+
const ErrorMessage_1 = require("./ErrorMessage");
|
|
45
|
+
exports.StreamingTranscriptionResponse = core.serialization
|
|
46
|
+
.union("type", {
|
|
47
|
+
transcript: TranscriptMessage_1.TranscriptMessage,
|
|
48
|
+
flush_done: FlushDoneMessage_1.FlushDoneMessage,
|
|
49
|
+
done: DoneMessage_1.DoneMessage,
|
|
50
|
+
error: ErrorMessage_1.ErrorMessage,
|
|
51
|
+
})
|
|
52
|
+
.transform({
|
|
53
|
+
transform: (value) => value,
|
|
54
|
+
untransform: (value) => value,
|
|
55
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const SttEncoding: core.serialization.Schema<serializers.SttEncoding.Raw, Cartesia.SttEncoding>;
|
|
8
|
+
export declare namespace SttEncoding {
|
|
9
|
+
type Raw = "pcm_s16le";
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SttEncoding = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.SttEncoding = core.serialization.enum_(["pcm_s16le"]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const TranscriptMessage: core.serialization.ObjectSchema<serializers.TranscriptMessage.Raw, Cartesia.TranscriptMessage>;
|
|
8
|
+
export declare namespace TranscriptMessage {
|
|
9
|
+
interface Raw {
|
|
10
|
+
request_id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
is_final: boolean;
|
|
13
|
+
duration?: number | null;
|
|
14
|
+
language?: string | null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TranscriptMessage = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.TranscriptMessage = core.serialization.object({
|
|
42
|
+
requestId: core.serialization.property("request_id", core.serialization.string()),
|
|
43
|
+
text: core.serialization.string(),
|
|
44
|
+
isFinal: core.serialization.property("is_final", core.serialization.boolean()),
|
|
45
|
+
duration: core.serialization.number().optional(),
|
|
46
|
+
language: core.serialization.string().optional(),
|
|
47
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "../../../index";
|
|
5
|
+
import * as Cartesia from "../../../../api/index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare const TranscriptionResponse: core.serialization.ObjectSchema<serializers.TranscriptionResponse.Raw, Cartesia.TranscriptionResponse>;
|
|
8
|
+
export declare namespace TranscriptionResponse {
|
|
9
|
+
interface Raw {
|
|
10
|
+
text: string;
|
|
11
|
+
language?: string | null;
|
|
12
|
+
duration?: number | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TranscriptionResponse = void 0;
|
|
40
|
+
const core = __importStar(require("../../../../core"));
|
|
41
|
+
exports.TranscriptionResponse = core.serialization.object({
|
|
42
|
+
text: core.serialization.string(),
|
|
43
|
+
language: core.serialization.string().optional(),
|
|
44
|
+
duration: core.serialization.number().optional(),
|
|
45
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./TranscriptionResponse";
|
|
2
|
+
export * from "./StreamingTranscriptionResponse";
|
|
3
|
+
export * from "./TranscriptMessage";
|
|
4
|
+
export * from "./FlushDoneMessage";
|
|
5
|
+
export * from "./DoneMessage";
|
|
6
|
+
export * from "./ErrorMessage";
|
|
7
|
+
export * from "./SttEncoding";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TranscriptionResponse"), exports);
|
|
18
|
+
__exportStar(require("./StreamingTranscriptionResponse"), exports);
|
|
19
|
+
__exportStar(require("./TranscriptMessage"), exports);
|
|
20
|
+
__exportStar(require("./FlushDoneMessage"), exports);
|
|
21
|
+
__exportStar(require("./DoneMessage"), exports);
|
|
22
|
+
__exportStar(require("./ErrorMessage"), exports);
|
|
23
|
+
__exportStar(require("./SttEncoding"), exports);
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.2.
|
|
1
|
+
export declare const SDK_VERSION = "2.2.4";
|
package/version.js
CHANGED
package/wrapper/Client.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { CartesiaClient as FernCartesiaClient } from "../Client";
|
|
2
2
|
import { StreamingTTSClient } from "./StreamingTTSClient";
|
|
3
|
+
import { StreamingSTTClient } from "./StreamingSTTClient";
|
|
3
4
|
export declare class CartesiaClient extends FernCartesiaClient {
|
|
5
|
+
protected _stt: StreamingSTTClient | undefined;
|
|
4
6
|
protected _tts: StreamingTTSClient | undefined;
|
|
7
|
+
get stt(): StreamingSTTClient;
|
|
5
8
|
get tts(): StreamingTTSClient;
|
|
6
9
|
}
|
package/wrapper/Client.js
CHANGED
|
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CartesiaClient = void 0;
|
|
4
4
|
const Client_1 = require("../Client");
|
|
5
5
|
const StreamingTTSClient_1 = require("./StreamingTTSClient");
|
|
6
|
+
const StreamingSTTClient_1 = require("./StreamingSTTClient");
|
|
6
7
|
class CartesiaClient extends Client_1.CartesiaClient {
|
|
8
|
+
get stt() {
|
|
9
|
+
var _a;
|
|
10
|
+
return ((_a = this._stt) !== null && _a !== void 0 ? _a : (this._stt = new StreamingSTTClient_1.StreamingSTTClient(this._options)));
|
|
11
|
+
}
|
|
7
12
|
get tts() {
|
|
8
13
|
var _a;
|
|
9
14
|
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new StreamingTTSClient_1.StreamingTTSClient(this._options)));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Stt } from "../api/resources/stt/client/Client";
|
|
2
|
+
import SttWebsocket, { SttWebSocketOptions } from "./SttWebsocket";
|
|
3
|
+
export declare class StreamingSTTClient extends Stt {
|
|
4
|
+
constructor(options?: Stt.Options);
|
|
5
|
+
websocket(options?: SttWebSocketOptions): SttWebsocket;
|
|
6
|
+
}
|