@corti/sdk 0.1.0-alpha.rc → 0.1.2-alpha
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/transcripts/client/requests/TranscriptsCreateRequest.d.ts +1 -1
- package/dist/cjs/api/resources/transcripts/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/transcripts/types/index.js +0 -1
- package/dist/cjs/api/types/StreamSupportedLanguage.d.ts +1 -17
- package/dist/cjs/api/types/StreamSupportedLanguage.js +0 -17
- package/dist/cjs/api/types/TranscribeSupportedLanguage.d.ts +1 -17
- package/dist/cjs/api/types/TranscribeSupportedLanguage.js +0 -17
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +7 -4
- package/dist/cjs/core/fetcher/BinaryResponse.js +5 -2
- package/dist/cjs/core/fetcher/Fetcher.js +3 -3
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +44 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +2 -1
- package/dist/cjs/core/url/join.js +23 -3
- package/dist/cjs/custom/CortiClient.d.ts +4 -1
- package/dist/cjs/custom/CortiClient.js +7 -1
- package/dist/cjs/custom/CustomStream.d.ts +3 -1
- package/dist/cjs/custom/CustomStream.js +21 -1
- package/dist/cjs/custom/CustomStreamSocket.d.ts +5 -1
- package/dist/cjs/custom/CustomStreamSocket.js +8 -0
- package/dist/cjs/custom/CustomTranscribe.d.ts +3 -1
- package/dist/cjs/custom/CustomTranscribe.js +21 -1
- package/dist/cjs/custom/CustomTranscribeSocket.d.ts +5 -1
- package/dist/cjs/custom/CustomTranscribeSocket.js +8 -0
- package/dist/cjs/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.d.ts +1 -2
- package/dist/cjs/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.js +1 -2
- package/dist/cjs/serialization/resources/transcripts/types/index.d.ts +0 -1
- package/dist/cjs/serialization/resources/transcripts/types/index.js +0 -1
- package/dist/cjs/serialization/types/StreamSupportedLanguage.d.ts +1 -1
- package/dist/cjs/serialization/types/StreamSupportedLanguage.js +1 -16
- package/dist/cjs/serialization/types/TranscribeSupportedLanguage.d.ts +1 -1
- package/dist/cjs/serialization/types/TranscribeSupportedLanguage.js +1 -16
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/transcripts/client/requests/TranscriptsCreateRequest.d.mts +1 -1
- package/dist/esm/api/resources/transcripts/types/index.d.mts +0 -1
- package/dist/esm/api/resources/transcripts/types/index.mjs +0 -1
- package/dist/esm/api/types/StreamSupportedLanguage.d.mts +1 -17
- package/dist/esm/api/types/StreamSupportedLanguage.mjs +1 -16
- package/dist/esm/api/types/TranscribeSupportedLanguage.d.mts +1 -17
- package/dist/esm/api/types/TranscribeSupportedLanguage.mjs +1 -16
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +7 -4
- package/dist/esm/core/fetcher/BinaryResponse.mjs +5 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +3 -3
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +41 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +2 -1
- package/dist/esm/core/url/join.mjs +23 -3
- package/dist/esm/custom/CortiClient.d.mts +4 -1
- package/dist/esm/custom/CortiClient.mjs +7 -1
- package/dist/esm/custom/CustomStream.d.mts +3 -1
- package/dist/esm/custom/CustomStream.mjs +21 -1
- package/dist/esm/custom/CustomStreamSocket.d.mts +5 -1
- package/dist/esm/custom/CustomStreamSocket.mjs +8 -0
- package/dist/esm/custom/CustomTranscribe.d.mts +3 -1
- package/dist/esm/custom/CustomTranscribe.mjs +21 -1
- package/dist/esm/custom/CustomTranscribeSocket.d.mts +5 -1
- package/dist/esm/custom/CustomTranscribeSocket.mjs +8 -0
- package/dist/esm/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.d.mts +1 -2
- package/dist/esm/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.mjs +1 -2
- package/dist/esm/serialization/resources/transcripts/types/index.d.mts +0 -1
- package/dist/esm/serialization/resources/transcripts/types/index.mjs +0 -1
- package/dist/esm/serialization/types/StreamSupportedLanguage.d.mts +1 -1
- package/dist/esm/serialization/types/StreamSupportedLanguage.mjs +1 -16
- package/dist/esm/serialization/types/TranscribeSupportedLanguage.d.mts +1 -1
- package/dist/esm/serialization/types/TranscribeSupportedLanguage.mjs +1 -16
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +1 -1
- package/dist/cjs/api/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.d.ts +0 -21
- package/dist/cjs/api/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.js +0 -20
- package/dist/cjs/serialization/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.d.ts +0 -10
- package/dist/cjs/serialization/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.js +0 -41
- package/dist/esm/api/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.d.mts +0 -21
- package/dist/esm/api/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.mjs +0 -17
- package/dist/esm/serialization/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.d.mts +0 -10
- package/dist/esm/serialization/resources/transcripts/types/TranscriptsCreateRequestPrimaryLanguage.mjs +0 -5
package/dist/cjs/Client.js
CHANGED
|
@@ -63,8 +63,8 @@ class CortiClient {
|
|
|
63
63
|
"Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
|
|
64
64
|
"X-Fern-Language": "JavaScript",
|
|
65
65
|
"X-Fern-SDK-Name": "@corti/sdk",
|
|
66
|
-
"X-Fern-SDK-Version": "0.1.
|
|
67
|
-
"User-Agent": "@corti/sdk/0.1.
|
|
66
|
+
"X-Fern-SDK-Version": "0.1.2-alpha",
|
|
67
|
+
"User-Agent": "@corti/sdk/0.1.2-alpha",
|
|
68
68
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
69
69
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
70
70
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -14,7 +14,7 @@ export interface TranscriptsCreateRequest {
|
|
|
14
14
|
/** The unique identifier for the recording. */
|
|
15
15
|
recordingId: Corti.Uuid;
|
|
16
16
|
/** The primary spoken language of the recording. Check https://docs.corti.ai/about/languages for more. */
|
|
17
|
-
primaryLanguage:
|
|
17
|
+
primaryLanguage: string;
|
|
18
18
|
/** Indicates whether spoken dictation commands should be converted to punctuation (e.g., 'comma' → ','). */
|
|
19
19
|
isDictation?: boolean;
|
|
20
20
|
/** If true, each audio channel is transcribed separately. */
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./TranscriptsCreateRequestPrimaryLanguage.js"), exports);
|
|
18
17
|
__exportStar(require("./TranscriptsCreateRequestModelName.js"), exports);
|
|
@@ -4,20 +4,4 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported language codes
|
|
6
6
|
*/
|
|
7
|
-
export type StreamSupportedLanguage =
|
|
8
|
-
export declare const StreamSupportedLanguage: {
|
|
9
|
-
readonly En: "en";
|
|
10
|
-
readonly EnUs: "en-us";
|
|
11
|
-
readonly EnGb: "en-gb";
|
|
12
|
-
readonly Da: "da";
|
|
13
|
-
readonly Se: "se";
|
|
14
|
-
readonly No: "no";
|
|
15
|
-
readonly De: "de";
|
|
16
|
-
readonly Nl: "nl";
|
|
17
|
-
readonly Es: "es";
|
|
18
|
-
readonly It: "it";
|
|
19
|
-
readonly Fr: "fr";
|
|
20
|
-
readonly Pt: "pt";
|
|
21
|
-
readonly DeCh: "de-ch";
|
|
22
|
-
readonly Sv: "sv";
|
|
23
|
-
};
|
|
7
|
+
export type StreamSupportedLanguage = string;
|
|
@@ -3,20 +3,3 @@
|
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StreamSupportedLanguage = void 0;
|
|
7
|
-
exports.StreamSupportedLanguage = {
|
|
8
|
-
En: "en",
|
|
9
|
-
EnUs: "en-us",
|
|
10
|
-
EnGb: "en-gb",
|
|
11
|
-
Da: "da",
|
|
12
|
-
Se: "se",
|
|
13
|
-
No: "no",
|
|
14
|
-
De: "de",
|
|
15
|
-
Nl: "nl",
|
|
16
|
-
Es: "es",
|
|
17
|
-
It: "it",
|
|
18
|
-
Fr: "fr",
|
|
19
|
-
Pt: "pt",
|
|
20
|
-
DeCh: "de-ch",
|
|
21
|
-
Sv: "sv",
|
|
22
|
-
};
|
|
@@ -4,20 +4,4 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported language codes for transcription
|
|
6
6
|
*/
|
|
7
|
-
export type TranscribeSupportedLanguage =
|
|
8
|
-
export declare const TranscribeSupportedLanguage: {
|
|
9
|
-
readonly En: "en";
|
|
10
|
-
readonly EnUs: "en-us";
|
|
11
|
-
readonly EnGb: "en-gb";
|
|
12
|
-
readonly Da: "da";
|
|
13
|
-
readonly Se: "se";
|
|
14
|
-
readonly No: "no";
|
|
15
|
-
readonly De: "de";
|
|
16
|
-
readonly Nl: "nl";
|
|
17
|
-
readonly Es: "es";
|
|
18
|
-
readonly It: "it";
|
|
19
|
-
readonly Fr: "fr";
|
|
20
|
-
readonly Pt: "pt";
|
|
21
|
-
readonly DeCh: "de-ch";
|
|
22
|
-
readonly Sv: "sv";
|
|
23
|
-
};
|
|
7
|
+
export type TranscribeSupportedLanguage = string;
|
|
@@ -3,20 +3,3 @@
|
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TranscribeSupportedLanguage = void 0;
|
|
7
|
-
exports.TranscribeSupportedLanguage = {
|
|
8
|
-
En: "en",
|
|
9
|
-
EnUs: "en-us",
|
|
10
|
-
EnGb: "en-gb",
|
|
11
|
-
Da: "da",
|
|
12
|
-
Se: "se",
|
|
13
|
-
No: "no",
|
|
14
|
-
De: "de",
|
|
15
|
-
Nl: "nl",
|
|
16
|
-
Es: "es",
|
|
17
|
-
It: "it",
|
|
18
|
-
Fr: "fr",
|
|
19
|
-
Pt: "pt",
|
|
20
|
-
DeCh: "de-ch",
|
|
21
|
-
Sv: "sv",
|
|
22
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResponseWithBody } from "./ResponseWithBody.js";
|
|
2
|
-
export
|
|
2
|
+
export type BinaryResponse = {
|
|
3
3
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */
|
|
4
4
|
bodyUsed: boolean;
|
|
5
5
|
/**
|
|
@@ -11,7 +11,10 @@ export interface BinaryResponse {
|
|
|
11
11
|
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
12
12
|
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */
|
|
13
13
|
blob: () => Promise<Blob>;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
16
|
+
* Some versions of the Fetch API may not support this method.
|
|
17
|
+
*/
|
|
18
|
+
bytes?(): Promise<Uint8Array>;
|
|
19
|
+
};
|
|
17
20
|
export declare function getBinaryResponse(response: ResponseWithBody): BinaryResponse;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBinaryResponse = getBinaryResponse;
|
|
4
4
|
function getBinaryResponse(response) {
|
|
5
|
-
|
|
5
|
+
const binaryResponse = {
|
|
6
6
|
get bodyUsed() {
|
|
7
7
|
return response.bodyUsed;
|
|
8
8
|
},
|
|
9
9
|
stream: () => response.body,
|
|
10
10
|
arrayBuffer: response.arrayBuffer.bind(response),
|
|
11
11
|
blob: response.blob.bind(response),
|
|
12
|
-
bytes: response.bytes.bind(response),
|
|
13
12
|
};
|
|
13
|
+
if ("bytes" in response && typeof response.bytes === "function") {
|
|
14
|
+
binaryResponse.bytes = response.bytes.bind(response);
|
|
15
|
+
}
|
|
16
|
+
return binaryResponse;
|
|
14
17
|
}
|
|
@@ -15,6 +15,7 @@ const json_js_1 = require("../json.js");
|
|
|
15
15
|
const RawResponse_js_1 = require("./RawResponse.js");
|
|
16
16
|
const Supplier_js_1 = require("./Supplier.js");
|
|
17
17
|
const createRequestUrl_js_1 = require("./createRequestUrl.js");
|
|
18
|
+
const getErrorResponseBody_js_1 = require("./getErrorResponseBody.js");
|
|
18
19
|
const getFetchFn_js_1 = require("./getFetchFn.js");
|
|
19
20
|
const getRequestBody_js_1 = require("./getRequestBody.js");
|
|
20
21
|
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
@@ -55,11 +56,10 @@ function fetcherImpl(args) {
|
|
|
55
56
|
const response = yield (0, requestWithRetries_js_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
return (0, makeRequest_js_1.makeRequest)(fetchFn, url, args.method, yield getHeaders(args), requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
57
58
|
}), args.maxRetries);
|
|
58
|
-
const responseBody = yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType);
|
|
59
59
|
if (response.status >= 200 && response.status < 400) {
|
|
60
60
|
return {
|
|
61
61
|
ok: true,
|
|
62
|
-
body:
|
|
62
|
+
body: (yield (0, getResponseBody_js_1.getResponseBody)(response, args.responseType)),
|
|
63
63
|
headers: response.headers,
|
|
64
64
|
rawResponse: (0, RawResponse_js_1.toRawResponse)(response),
|
|
65
65
|
};
|
|
@@ -70,7 +70,7 @@ function fetcherImpl(args) {
|
|
|
70
70
|
error: {
|
|
71
71
|
reason: "status-code",
|
|
72
72
|
statusCode: response.status,
|
|
73
|
-
body:
|
|
73
|
+
body: yield (0, getErrorResponseBody_js_1.getErrorResponseBody)(response),
|
|
74
74
|
},
|
|
75
75
|
rawResponse: (0, RawResponse_js_1.toRawResponse)(response),
|
|
76
76
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getErrorResponseBody(response: Response): Promise<unknown>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getErrorResponseBody = getErrorResponseBody;
|
|
13
|
+
const json_js_1 = require("../json.js");
|
|
14
|
+
const getResponseBody_js_1 = require("./getResponseBody.js");
|
|
15
|
+
function getErrorResponseBody(response) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
let contentType = (_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
19
|
+
if (contentType == null || contentType.length === 0) {
|
|
20
|
+
return (0, getResponseBody_js_1.getResponseBody)(response);
|
|
21
|
+
}
|
|
22
|
+
if (contentType.indexOf(";") !== -1) {
|
|
23
|
+
contentType = (_c = (_b = contentType.split(";")[0]) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : "";
|
|
24
|
+
}
|
|
25
|
+
switch (contentType) {
|
|
26
|
+
case "application/hal+json":
|
|
27
|
+
case "application/json":
|
|
28
|
+
case "application/ld+json":
|
|
29
|
+
case "application/problem+json":
|
|
30
|
+
case "application/vnd.api+json":
|
|
31
|
+
case "text/json":
|
|
32
|
+
const text = yield response.text();
|
|
33
|
+
return text.length > 0 ? (0, json_js_1.fromJson)(text) : undefined;
|
|
34
|
+
default:
|
|
35
|
+
if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
|
|
36
|
+
const text = yield response.text();
|
|
37
|
+
return text.length > 0 ? (0, json_js_1.fromJson)(text) : undefined;
|
|
38
|
+
}
|
|
39
|
+
// Fallback to plain text if content type is not recognized
|
|
40
|
+
// Even if no body is present, the response will be an empty string
|
|
41
|
+
return yield response.text();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getResponseBody = getResponseBody;
|
|
13
13
|
const BinaryResponse_js_1 = require("./BinaryResponse.js");
|
|
14
14
|
const ResponseWithBody_js_1 = require("./ResponseWithBody.js");
|
|
15
|
+
const json_js_1 = require("../json.js");
|
|
15
16
|
function getResponseBody(response, responseType) {
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
if (!(0, ResponseWithBody_js_1.isResponseWithBody)(response)) {
|
|
@@ -35,7 +36,7 @@ function getResponseBody(response, responseType) {
|
|
|
35
36
|
const text = yield response.text();
|
|
36
37
|
if (text.length > 0) {
|
|
37
38
|
try {
|
|
38
|
-
let responseBody =
|
|
39
|
+
let responseBody = (0, json_js_1.fromJson)(text);
|
|
39
40
|
return responseBody;
|
|
40
41
|
}
|
|
41
42
|
catch (err) {
|
|
@@ -5,6 +5,9 @@ function join(base, ...segments) {
|
|
|
5
5
|
if (!base) {
|
|
6
6
|
return "";
|
|
7
7
|
}
|
|
8
|
+
if (segments.length === 0) {
|
|
9
|
+
return base;
|
|
10
|
+
}
|
|
8
11
|
if (base.includes("://")) {
|
|
9
12
|
let url;
|
|
10
13
|
try {
|
|
@@ -14,24 +17,37 @@ function join(base, ...segments) {
|
|
|
14
17
|
// Fallback to path joining if URL is malformed
|
|
15
18
|
return joinPath(base, ...segments);
|
|
16
19
|
}
|
|
20
|
+
const lastSegment = segments[segments.length - 1];
|
|
21
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
17
22
|
for (const segment of segments) {
|
|
18
23
|
const cleanSegment = trimSlashes(segment);
|
|
19
24
|
if (cleanSegment) {
|
|
20
25
|
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
28
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
|
|
29
|
+
url.pathname += "/";
|
|
30
|
+
}
|
|
23
31
|
return url.toString();
|
|
24
32
|
}
|
|
25
33
|
return joinPath(base, ...segments);
|
|
26
34
|
}
|
|
27
35
|
function joinPath(base, ...segments) {
|
|
36
|
+
if (segments.length === 0) {
|
|
37
|
+
return base;
|
|
38
|
+
}
|
|
28
39
|
let result = base;
|
|
40
|
+
const lastSegment = segments[segments.length - 1];
|
|
41
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
29
42
|
for (const segment of segments) {
|
|
30
43
|
const cleanSegment = trimSlashes(segment);
|
|
31
44
|
if (cleanSegment) {
|
|
32
45
|
result = joinPathSegments(result, cleanSegment);
|
|
33
46
|
}
|
|
34
47
|
}
|
|
48
|
+
if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
|
|
49
|
+
result += "/";
|
|
50
|
+
}
|
|
35
51
|
return result;
|
|
36
52
|
}
|
|
37
53
|
function joinPathSegments(left, right) {
|
|
@@ -43,7 +59,11 @@ function joinPathSegments(left, right) {
|
|
|
43
59
|
function trimSlashes(str) {
|
|
44
60
|
if (!str)
|
|
45
61
|
return str;
|
|
46
|
-
let start =
|
|
47
|
-
let end = str.
|
|
48
|
-
|
|
62
|
+
let start = 0;
|
|
63
|
+
let end = str.length;
|
|
64
|
+
if (str.startsWith("/"))
|
|
65
|
+
start = 1;
|
|
66
|
+
if (str.endsWith("/"))
|
|
67
|
+
end = str.length - 1;
|
|
68
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
49
69
|
}
|
|
@@ -40,7 +40,10 @@ export declare namespace CortiClient {
|
|
|
40
40
|
clientSecret: core.Supplier<string>;
|
|
41
41
|
}
|
|
42
42
|
interface Options {
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Patch: allow to pass a custom string-based environment
|
|
45
|
+
* */
|
|
46
|
+
environment: core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls> | string;
|
|
44
47
|
/** Override the Tenant-Name header */
|
|
45
48
|
tenantName: core.Supplier<string>;
|
|
46
49
|
/** Additional headers to include in requests. */
|
|
@@ -97,7 +97,13 @@ class CortiClient {
|
|
|
97
97
|
"User-Agent": `@corti/sdk/${version_js_1.SDK_VERSION}`,
|
|
98
98
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
99
99
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
100
|
-
}, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: "accessToken" in _options.auth ? _options.auth.accessToken : undefined
|
|
100
|
+
}, _options === null || _options === void 0 ? void 0 : _options.headers), clientId: "clientId" in _options.auth ? _options.auth.clientId : undefined, clientSecret: "clientSecret" in _options.auth ? _options.auth.clientSecret : undefined, token: "accessToken" in _options.auth ? _options.auth.accessToken : undefined, environment: typeof _options.environment === "string"
|
|
101
|
+
? {
|
|
102
|
+
base: `https://api.${_options.environment}.corti.app/v2`,
|
|
103
|
+
wss: `wss://api.${_options.environment}.corti.app`,
|
|
104
|
+
login: `https://auth.${_options.environment}.corti.app/realms`,
|
|
105
|
+
}
|
|
106
|
+
: _options.environment });
|
|
101
107
|
/**
|
|
102
108
|
* Patch: if `accessToken` is provided, use BearerProvider, otherwise use OAuthTokenProvider
|
|
103
109
|
*/
|
|
@@ -14,5 +14,7 @@ export declare class Stream extends FernStream {
|
|
|
14
14
|
/**
|
|
15
15
|
* Patch: use custom connect method to support passing _options parameters
|
|
16
16
|
*/
|
|
17
|
-
connect(args: Omit<FernStream.ConnectArgs, 'token' | 'tenantName'
|
|
17
|
+
connect({ configuration, ...args }: Omit<FernStream.ConnectArgs, 'token' | 'tenantName'> & {
|
|
18
|
+
configuration?: api.StreamConfig;
|
|
19
|
+
}): Promise<StreamSocket>;
|
|
18
20
|
}
|
|
@@ -41,6 +41,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
45
|
+
var t = {};
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
+
t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
};
|
|
44
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
56
|
exports.Stream = void 0;
|
|
46
57
|
/**
|
|
@@ -59,11 +70,12 @@ class Stream extends Client_js_1.Stream {
|
|
|
59
70
|
/**
|
|
60
71
|
* Patch: use custom connect method to support passing _options parameters
|
|
61
72
|
*/
|
|
62
|
-
connect(
|
|
73
|
+
connect(_a) {
|
|
63
74
|
const _super = Object.create(null, {
|
|
64
75
|
connect: { get: () => super.connect }
|
|
65
76
|
});
|
|
66
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
var { configuration } = _a, args = __rest(_a, ["configuration"]);
|
|
67
79
|
const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || '', tenantName: yield core.Supplier.get(this._options.tenantName) }));
|
|
68
80
|
const ws = new CustomStreamSocket_js_1.StreamSocket({ socket: fernWs.socket });
|
|
69
81
|
if (!configuration) {
|
|
@@ -98,6 +110,14 @@ class Stream extends Client_js_1.Stream {
|
|
|
98
110
|
ws.close();
|
|
99
111
|
return;
|
|
100
112
|
}
|
|
113
|
+
if (parsedResponse.ok && parsedResponse.value.type === 'error') {
|
|
114
|
+
ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
|
|
115
|
+
name: 'error',
|
|
116
|
+
message: JSON.stringify(parsedResponse.value.error),
|
|
117
|
+
}, ''));
|
|
118
|
+
ws.close();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
101
121
|
if (parsedResponse.ok && parsedResponse.value.type === 'ENDED') {
|
|
102
122
|
ws.close();
|
|
103
123
|
return;
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { StreamSocket as FernStreamSocket } from '../api/resources/stream/client/Socket.js';
|
|
5
5
|
export declare class StreamSocket extends FernStreamSocket {
|
|
6
|
-
sendAudio(message:
|
|
6
|
+
sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
|
|
7
7
|
/**
|
|
8
8
|
* Patch: have to repeat this method, because it is private in the base class
|
|
9
9
|
*/
|
|
10
10
|
private __assertSocketIsOpen;
|
|
11
|
+
/**
|
|
12
|
+
* Patch: added ability to remove event handlers
|
|
13
|
+
*/
|
|
14
|
+
off<T extends keyof FernStreamSocket.EventHandlers>(event: T, callback?: FernStreamSocket.EventHandlers[T]): void;
|
|
11
15
|
}
|
|
@@ -58,5 +58,13 @@ class StreamSocket extends Socket_js_1.StreamSocket {
|
|
|
58
58
|
throw new Error("Socket is not open.");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Patch: added ability to remove event handlers
|
|
63
|
+
*/
|
|
64
|
+
off(event, callback) {
|
|
65
|
+
if (!callback || callback === this.eventHandlers[event]) {
|
|
66
|
+
delete this.eventHandlers[event];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
exports.StreamSocket = StreamSocket;
|
|
@@ -14,5 +14,7 @@ export declare class Transcribe extends FernTranscribe {
|
|
|
14
14
|
/**
|
|
15
15
|
* Patch: use custom connect method to support passing _options parameters
|
|
16
16
|
*/
|
|
17
|
-
connect(args?: Omit<FernTranscribe.ConnectArgs, 'token' | 'tenantName'
|
|
17
|
+
connect({ configuration, ...args }?: Omit<FernTranscribe.ConnectArgs, 'token' | 'tenantName'> & {
|
|
18
|
+
configuration?: api.TranscribeConfig;
|
|
19
|
+
}): Promise<TranscribeSocket>;
|
|
18
20
|
}
|
|
@@ -41,6 +41,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
41
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
45
|
+
var t = {};
|
|
46
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
47
|
+
t[p] = s[p];
|
|
48
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
49
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
50
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
51
|
+
t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
};
|
|
44
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
56
|
exports.Transcribe = void 0;
|
|
46
57
|
/**
|
|
@@ -63,7 +74,8 @@ class Transcribe extends Client_js_1.Transcribe {
|
|
|
63
74
|
const _super = Object.create(null, {
|
|
64
75
|
connect: { get: () => super.connect }
|
|
65
76
|
});
|
|
66
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
77
|
+
return __awaiter(this, arguments, void 0, function* (_a = {}) {
|
|
78
|
+
var { configuration } = _a, args = __rest(_a, ["configuration"]);
|
|
67
79
|
const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || '', tenantName: yield core.Supplier.get(this._options.tenantName) }));
|
|
68
80
|
const ws = new CustomTranscribeSocket_js_1.TranscribeSocket({ socket: fernWs.socket });
|
|
69
81
|
if (!configuration) {
|
|
@@ -96,6 +108,14 @@ class Transcribe extends Client_js_1.Transcribe {
|
|
|
96
108
|
ws.close();
|
|
97
109
|
return;
|
|
98
110
|
}
|
|
111
|
+
if (parsedResponse.ok && parsedResponse.value.type === 'error') {
|
|
112
|
+
ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
|
|
113
|
+
name: 'error',
|
|
114
|
+
message: JSON.stringify(parsedResponse.value.error),
|
|
115
|
+
}, ''));
|
|
116
|
+
ws.close();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
99
119
|
if (parsedResponse.ok && parsedResponse.value.type === 'ended') {
|
|
100
120
|
ws.close();
|
|
101
121
|
return;
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { TranscribeSocket as FernTranscribeSocket } from '../api/resources/transcribe/client/Socket.js';
|
|
5
5
|
export declare class TranscribeSocket extends FernTranscribeSocket {
|
|
6
|
-
sendAudio(message:
|
|
6
|
+
sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
|
|
7
7
|
/**
|
|
8
8
|
* Patch: have to repeat this method, because it is private in the base class
|
|
9
9
|
*/
|
|
10
10
|
private __assertSocketIsOpen;
|
|
11
|
+
/**
|
|
12
|
+
* Patch: added ability to remove event handlers
|
|
13
|
+
*/
|
|
14
|
+
off<T extends keyof FernTranscribeSocket.EventHandlers>(event: T, callback?: FernTranscribeSocket.EventHandlers[T]): void;
|
|
11
15
|
}
|
|
@@ -58,5 +58,13 @@ class TranscribeSocket extends Socket_js_1.TranscribeSocket {
|
|
|
58
58
|
throw new Error("Socket is not open.");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Patch: added ability to remove event handlers
|
|
63
|
+
*/
|
|
64
|
+
off(event, callback) {
|
|
65
|
+
if (!callback || callback === this.eventHandlers[event]) {
|
|
66
|
+
delete this.eventHandlers[event];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
exports.TranscribeSocket = TranscribeSocket;
|
package/dist/cjs/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.d.ts
CHANGED
|
@@ -5,14 +5,13 @@ import * as serializers from "../../../../index.js";
|
|
|
5
5
|
import * as Corti from "../../../../../api/index.js";
|
|
6
6
|
import * as core from "../../../../../core/index.js";
|
|
7
7
|
import { Uuid } from "../../../../types/Uuid.js";
|
|
8
|
-
import { TranscriptsCreateRequestPrimaryLanguage } from "../../types/TranscriptsCreateRequestPrimaryLanguage.js";
|
|
9
8
|
import { TranscriptsParticipant } from "../../../../types/TranscriptsParticipant.js";
|
|
10
9
|
import { TranscriptsCreateRequestModelName } from "../../types/TranscriptsCreateRequestModelName.js";
|
|
11
10
|
export declare const TranscriptsCreateRequest: core.serialization.Schema<serializers.TranscriptsCreateRequest.Raw, Corti.TranscriptsCreateRequest>;
|
|
12
11
|
export declare namespace TranscriptsCreateRequest {
|
|
13
12
|
interface Raw {
|
|
14
13
|
recordingId: Uuid.Raw;
|
|
15
|
-
primaryLanguage:
|
|
14
|
+
primaryLanguage: string;
|
|
16
15
|
isDictation?: boolean | null;
|
|
17
16
|
isMultichannel?: boolean | null;
|
|
18
17
|
diarize?: boolean | null;
|
package/dist/cjs/serialization/resources/transcripts/client/requests/TranscriptsCreateRequest.js
CHANGED
|
@@ -39,12 +39,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.TranscriptsCreateRequest = void 0;
|
|
40
40
|
const core = __importStar(require("../../../../../core/index.js"));
|
|
41
41
|
const Uuid_js_1 = require("../../../../types/Uuid.js");
|
|
42
|
-
const TranscriptsCreateRequestPrimaryLanguage_js_1 = require("../../types/TranscriptsCreateRequestPrimaryLanguage.js");
|
|
43
42
|
const TranscriptsParticipant_js_1 = require("../../../../types/TranscriptsParticipant.js");
|
|
44
43
|
const TranscriptsCreateRequestModelName_js_1 = require("../../types/TranscriptsCreateRequestModelName.js");
|
|
45
44
|
exports.TranscriptsCreateRequest = core.serialization.object({
|
|
46
45
|
recordingId: Uuid_js_1.Uuid,
|
|
47
|
-
primaryLanguage:
|
|
46
|
+
primaryLanguage: core.serialization.string(),
|
|
48
47
|
isDictation: core.serialization.boolean().optional(),
|
|
49
48
|
isMultichannel: core.serialization.boolean().optional(),
|
|
50
49
|
diarize: core.serialization.boolean().optional(),
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./TranscriptsCreateRequestPrimaryLanguage.js"), exports);
|
|
18
17
|
__exportStar(require("./TranscriptsCreateRequestModelName.js"), exports);
|
|
@@ -6,5 +6,5 @@ import * as Corti from "../../api/index.js";
|
|
|
6
6
|
import * as core from "../../core/index.js";
|
|
7
7
|
export declare const StreamSupportedLanguage: core.serialization.Schema<serializers.StreamSupportedLanguage.Raw, Corti.StreamSupportedLanguage>;
|
|
8
8
|
export declare namespace StreamSupportedLanguage {
|
|
9
|
-
type Raw =
|
|
9
|
+
type Raw = string;
|
|
10
10
|
}
|
|
@@ -38,19 +38,4 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.StreamSupportedLanguage = void 0;
|
|
40
40
|
const core = __importStar(require("../../core/index.js"));
|
|
41
|
-
exports.StreamSupportedLanguage = core.serialization.
|
|
42
|
-
"en",
|
|
43
|
-
"en-us",
|
|
44
|
-
"en-gb",
|
|
45
|
-
"da",
|
|
46
|
-
"se",
|
|
47
|
-
"no",
|
|
48
|
-
"de",
|
|
49
|
-
"nl",
|
|
50
|
-
"es",
|
|
51
|
-
"it",
|
|
52
|
-
"fr",
|
|
53
|
-
"pt",
|
|
54
|
-
"de-ch",
|
|
55
|
-
"sv",
|
|
56
|
-
]);
|
|
41
|
+
exports.StreamSupportedLanguage = core.serialization.string();
|
|
@@ -6,5 +6,5 @@ import * as Corti from "../../api/index.js";
|
|
|
6
6
|
import * as core from "../../core/index.js";
|
|
7
7
|
export declare const TranscribeSupportedLanguage: core.serialization.Schema<serializers.TranscribeSupportedLanguage.Raw, Corti.TranscribeSupportedLanguage>;
|
|
8
8
|
export declare namespace TranscribeSupportedLanguage {
|
|
9
|
-
type Raw =
|
|
9
|
+
type Raw = string;
|
|
10
10
|
}
|
|
@@ -38,19 +38,4 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.TranscribeSupportedLanguage = void 0;
|
|
40
40
|
const core = __importStar(require("../../core/index.js"));
|
|
41
|
-
exports.TranscribeSupportedLanguage = core.serialization.
|
|
42
|
-
"en",
|
|
43
|
-
"en-us",
|
|
44
|
-
"en-gb",
|
|
45
|
-
"da",
|
|
46
|
-
"se",
|
|
47
|
-
"no",
|
|
48
|
-
"de",
|
|
49
|
-
"nl",
|
|
50
|
-
"es",
|
|
51
|
-
"it",
|
|
52
|
-
"fr",
|
|
53
|
-
"pt",
|
|
54
|
-
"de-ch",
|
|
55
|
-
"sv",
|
|
56
|
-
]);
|
|
41
|
+
exports.TranscribeSupportedLanguage = core.serialization.string();
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.1.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.2-alpha";
|
package/dist/cjs/version.js
CHANGED