@corti/sdk 0.6.1 → 0.7.0
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 +2 -2
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/errors/InternalServerError.d.ts +2 -1
- package/dist/cjs/api/resources/documents/client/Client.js +35 -5
- package/dist/cjs/api/resources/facts/client/Client.js +7 -1
- package/dist/cjs/api/resources/interactions/client/Client.js +7 -1
- package/dist/cjs/api/resources/recordings/client/Client.js +28 -4
- package/dist/cjs/api/resources/stream/client/Socket.d.ts +2 -1
- package/dist/cjs/api/resources/stream/client/Socket.js +13 -3
- package/dist/cjs/api/resources/templates/client/Client.js +21 -3
- package/dist/cjs/api/resources/transcribe/client/Socket.d.ts +2 -1
- package/dist/cjs/api/resources/transcribe/client/Socket.js +13 -3
- package/dist/cjs/api/resources/transcripts/client/Client.js +28 -4
- package/dist/cjs/api/types/StreamFlushMessage.d.ts +6 -0
- package/dist/cjs/api/types/StreamFlushMessage.js +5 -0
- package/dist/cjs/api/types/StreamFlushedMessage.d.ts +6 -0
- package/dist/cjs/api/types/StreamFlushedMessage.js +5 -0
- package/dist/cjs/api/types/TranscribeFlushMessage.d.ts +6 -0
- package/dist/cjs/api/types/TranscribeFlushMessage.js +5 -0
- package/dist/cjs/api/types/TranscribeFlushedMessage.d.ts +6 -0
- package/dist/cjs/api/types/TranscribeFlushedMessage.js +5 -0
- package/dist/cjs/api/types/index.d.ts +4 -0
- package/dist/cjs/api/types/index.js +4 -0
- package/dist/cjs/custom/CortiAuth.d.ts +3 -3
- package/dist/cjs/custom/CortiAuth.js +10 -10
- package/dist/cjs/custom/CortiClient.js +11 -10
- package/dist/cjs/custom/CustomStream.d.ts +1 -1
- package/dist/cjs/custom/CustomStream.js +15 -14
- package/dist/cjs/custom/CustomStreamSocket.d.ts +1 -1
- package/dist/cjs/custom/CustomStreamSocket.js +1 -1
- package/dist/cjs/custom/CustomTranscribe.d.ts +1 -1
- package/dist/cjs/custom/CustomTranscribe.js +12 -12
- package/dist/cjs/custom/CustomTranscribeSocket.d.ts +1 -1
- package/dist/cjs/custom/CustomTranscribeSocket.js +1 -1
- package/dist/cjs/custom/RefreshBearerProvider.d.ts +1 -1
- package/dist/cjs/custom/utils/decodeToken.js +6 -8
- package/dist/cjs/custom/utils/localStorage.js +3 -1
- package/dist/cjs/custom/utils/pkce.js +2 -5
- package/dist/cjs/custom/utils/resolveClientOptions.js +1 -2
- package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.d.ts +3 -2
- package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.js +2 -0
- package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.ts +3 -2
- package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.js +2 -0
- package/dist/cjs/serialization/types/StreamFlushMessage.d.ts +12 -0
- package/dist/cjs/serialization/types/StreamFlushMessage.js +43 -0
- package/dist/cjs/serialization/types/StreamFlushedMessage.d.ts +12 -0
- package/dist/cjs/serialization/types/StreamFlushedMessage.js +43 -0
- package/dist/cjs/serialization/types/TranscribeFlushMessage.d.ts +12 -0
- package/dist/cjs/serialization/types/TranscribeFlushMessage.js +43 -0
- package/dist/cjs/serialization/types/TranscribeFlushedMessage.d.ts +12 -0
- package/dist/cjs/serialization/types/TranscribeFlushedMessage.js +43 -0
- package/dist/cjs/serialization/types/index.d.ts +4 -0
- package/dist/cjs/serialization/types/index.js +4 -0
- 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/errors/InternalServerError.d.mts +2 -1
- package/dist/esm/api/resources/documents/client/Client.mjs +35 -5
- package/dist/esm/api/resources/facts/client/Client.mjs +7 -1
- package/dist/esm/api/resources/interactions/client/Client.mjs +7 -1
- package/dist/esm/api/resources/recordings/client/Client.mjs +28 -4
- package/dist/esm/api/resources/stream/client/Socket.d.mts +2 -1
- package/dist/esm/api/resources/stream/client/Socket.mjs +13 -3
- package/dist/esm/api/resources/templates/client/Client.mjs +21 -3
- package/dist/esm/api/resources/transcribe/client/Socket.d.mts +2 -1
- package/dist/esm/api/resources/transcribe/client/Socket.mjs +13 -3
- package/dist/esm/api/resources/transcripts/client/Client.mjs +28 -4
- package/dist/esm/api/types/StreamFlushMessage.d.mts +6 -0
- package/dist/esm/api/types/StreamFlushMessage.mjs +4 -0
- package/dist/esm/api/types/StreamFlushedMessage.d.mts +6 -0
- package/dist/esm/api/types/StreamFlushedMessage.mjs +4 -0
- package/dist/esm/api/types/TranscribeFlushMessage.d.mts +6 -0
- package/dist/esm/api/types/TranscribeFlushMessage.mjs +4 -0
- package/dist/esm/api/types/TranscribeFlushedMessage.d.mts +6 -0
- package/dist/esm/api/types/TranscribeFlushedMessage.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +4 -0
- package/dist/esm/api/types/index.mjs +4 -0
- package/dist/esm/custom/CortiAuth.d.mts +3 -3
- package/dist/esm/custom/CortiAuth.mjs +10 -10
- package/dist/esm/custom/CortiClient.mjs +11 -10
- package/dist/esm/custom/CustomStream.d.mts +1 -1
- package/dist/esm/custom/CustomStream.mjs +15 -14
- package/dist/esm/custom/CustomStreamSocket.d.mts +1 -1
- package/dist/esm/custom/CustomStreamSocket.mjs +2 -2
- package/dist/esm/custom/CustomTranscribe.d.mts +1 -1
- package/dist/esm/custom/CustomTranscribe.mjs +12 -12
- package/dist/esm/custom/CustomTranscribeSocket.d.mts +1 -1
- package/dist/esm/custom/CustomTranscribeSocket.mjs +2 -2
- package/dist/esm/custom/RefreshBearerProvider.d.mts +1 -1
- package/dist/esm/custom/utils/decodeToken.mjs +6 -8
- package/dist/esm/custom/utils/localStorage.mjs +3 -1
- package/dist/esm/custom/utils/pkce.mjs +2 -5
- package/dist/esm/custom/utils/resolveClientOptions.mjs +1 -2
- package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.d.mts +3 -2
- package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.mjs +2 -0
- package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.mts +3 -2
- package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.mjs +2 -0
- package/dist/esm/serialization/types/StreamFlushMessage.d.mts +12 -0
- package/dist/esm/serialization/types/StreamFlushMessage.mjs +7 -0
- package/dist/esm/serialization/types/StreamFlushedMessage.d.mts +12 -0
- package/dist/esm/serialization/types/StreamFlushedMessage.mjs +7 -0
- package/dist/esm/serialization/types/TranscribeFlushMessage.d.mts +12 -0
- package/dist/esm/serialization/types/TranscribeFlushMessage.mjs +7 -0
- package/dist/esm/serialization/types/TranscribeFlushedMessage.d.mts +12 -0
- package/dist/esm/serialization/types/TranscribeFlushedMessage.mjs +7 -0
- package/dist/esm/serialization/types/index.d.mts +4 -0
- package/dist/esm/serialization/types/index.mjs +4 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ const client = new CortiClient({
|
|
|
39
39
|
// Or using a bearer token
|
|
40
40
|
const client = new CortiClient({
|
|
41
41
|
auth: {
|
|
42
|
-
accessToken: "YOUR_ACCESS_TOKEN"
|
|
42
|
+
accessToken: "YOUR_ACCESS_TOKEN",
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -50,7 +50,7 @@ const client = new CortiClient({
|
|
|
50
50
|
refreshAccessToken: async (refreshToken?: string) => {
|
|
51
51
|
// Your custom logic to get a new access token
|
|
52
52
|
const response = await fetch("https://your-auth-server/token", {
|
|
53
|
-
method: "POST",
|
|
53
|
+
method: "POST",
|
|
54
54
|
headers: { "Content-Type": "application/json" },
|
|
55
55
|
body: JSON.stringify({ refreshToken }),
|
|
56
56
|
});
|
package/dist/cjs/Client.js
CHANGED
|
@@ -64,8 +64,8 @@ class CortiClient {
|
|
|
64
64
|
"Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
|
|
65
65
|
"X-Fern-Language": "JavaScript",
|
|
66
66
|
"X-Fern-SDK-Name": "@corti/sdk",
|
|
67
|
-
"X-Fern-SDK-Version": "0.
|
|
68
|
-
"User-Agent": "@corti/sdk/0.
|
|
67
|
+
"X-Fern-SDK-Version": "0.7.0",
|
|
68
|
+
"User-Agent": "@corti/sdk/0.7.0",
|
|
69
69
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
70
70
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
71
71
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as errors from "../../errors/index.js";
|
|
5
|
+
import * as Corti from "../index.js";
|
|
5
6
|
import * as core from "../../core/index.js";
|
|
6
7
|
export declare class InternalServerError extends errors.CortiError {
|
|
7
|
-
constructor(body
|
|
8
|
+
constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse);
|
|
8
9
|
}
|
|
@@ -111,7 +111,13 @@ class Documents {
|
|
|
111
111
|
breadcrumbsPrefix: ["response"],
|
|
112
112
|
}), _response.rawResponse);
|
|
113
113
|
case 500:
|
|
114
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
114
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
115
|
+
unrecognizedObjectKeys: "passthrough",
|
|
116
|
+
allowUnrecognizedUnionMembers: true,
|
|
117
|
+
allowUnrecognizedEnumValues: true,
|
|
118
|
+
skipValidation: true,
|
|
119
|
+
breadcrumbsPrefix: ["response"],
|
|
120
|
+
}), _response.rawResponse);
|
|
115
121
|
case 504:
|
|
116
122
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
117
123
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -218,7 +224,13 @@ class Documents {
|
|
|
218
224
|
breadcrumbsPrefix: ["response"],
|
|
219
225
|
}), _response.rawResponse);
|
|
220
226
|
case 500:
|
|
221
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
227
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
228
|
+
unrecognizedObjectKeys: "passthrough",
|
|
229
|
+
allowUnrecognizedUnionMembers: true,
|
|
230
|
+
allowUnrecognizedEnumValues: true,
|
|
231
|
+
skipValidation: true,
|
|
232
|
+
breadcrumbsPrefix: ["response"],
|
|
233
|
+
}), _response.rawResponse);
|
|
222
234
|
case 504:
|
|
223
235
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
224
236
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -309,7 +321,13 @@ class Documents {
|
|
|
309
321
|
breadcrumbsPrefix: ["response"],
|
|
310
322
|
}), _response.rawResponse);
|
|
311
323
|
case 500:
|
|
312
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
324
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
325
|
+
unrecognizedObjectKeys: "passthrough",
|
|
326
|
+
allowUnrecognizedUnionMembers: true,
|
|
327
|
+
allowUnrecognizedEnumValues: true,
|
|
328
|
+
skipValidation: true,
|
|
329
|
+
breadcrumbsPrefix: ["response"],
|
|
330
|
+
}), _response.rawResponse);
|
|
313
331
|
case 504:
|
|
314
332
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
315
333
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -389,7 +407,13 @@ class Documents {
|
|
|
389
407
|
case 404:
|
|
390
408
|
throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
|
|
391
409
|
case 500:
|
|
392
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
410
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
411
|
+
unrecognizedObjectKeys: "passthrough",
|
|
412
|
+
allowUnrecognizedUnionMembers: true,
|
|
413
|
+
allowUnrecognizedEnumValues: true,
|
|
414
|
+
skipValidation: true,
|
|
415
|
+
breadcrumbsPrefix: ["response"],
|
|
416
|
+
}), _response.rawResponse);
|
|
393
417
|
case 504:
|
|
394
418
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
395
419
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -485,7 +509,13 @@ class Documents {
|
|
|
485
509
|
breadcrumbsPrefix: ["response"],
|
|
486
510
|
}), _response.rawResponse);
|
|
487
511
|
case 500:
|
|
488
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
512
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
513
|
+
unrecognizedObjectKeys: "passthrough",
|
|
514
|
+
allowUnrecognizedUnionMembers: true,
|
|
515
|
+
allowUnrecognizedEnumValues: true,
|
|
516
|
+
skipValidation: true,
|
|
517
|
+
breadcrumbsPrefix: ["response"],
|
|
518
|
+
}), _response.rawResponse);
|
|
489
519
|
case 504:
|
|
490
520
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
491
521
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -97,7 +97,13 @@ class Facts {
|
|
|
97
97
|
if (_response.error.reason === "status-code") {
|
|
98
98
|
switch (_response.error.statusCode) {
|
|
99
99
|
case 500:
|
|
100
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
100
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
101
|
+
unrecognizedObjectKeys: "passthrough",
|
|
102
|
+
allowUnrecognizedUnionMembers: true,
|
|
103
|
+
allowUnrecognizedEnumValues: true,
|
|
104
|
+
skipValidation: true,
|
|
105
|
+
breadcrumbsPrefix: ["response"],
|
|
106
|
+
}), _response.rawResponse);
|
|
101
107
|
default:
|
|
102
108
|
throw new errors.CortiError({
|
|
103
109
|
statusCode: _response.error.statusCode,
|
|
@@ -253,7 +253,13 @@ class Interactions {
|
|
|
253
253
|
breadcrumbsPrefix: ["response"],
|
|
254
254
|
}), _response.rawResponse);
|
|
255
255
|
case 500:
|
|
256
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
256
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
257
|
+
unrecognizedObjectKeys: "passthrough",
|
|
258
|
+
allowUnrecognizedUnionMembers: true,
|
|
259
|
+
allowUnrecognizedEnumValues: true,
|
|
260
|
+
skipValidation: true,
|
|
261
|
+
breadcrumbsPrefix: ["response"],
|
|
262
|
+
}), _response.rawResponse);
|
|
257
263
|
case 504:
|
|
258
264
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
259
265
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -111,7 +111,13 @@ class Recordings {
|
|
|
111
111
|
breadcrumbsPrefix: ["response"],
|
|
112
112
|
}), _response.rawResponse);
|
|
113
113
|
case 500:
|
|
114
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
114
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
115
|
+
unrecognizedObjectKeys: "passthrough",
|
|
116
|
+
allowUnrecognizedUnionMembers: true,
|
|
117
|
+
allowUnrecognizedEnumValues: true,
|
|
118
|
+
skipValidation: true,
|
|
119
|
+
breadcrumbsPrefix: ["response"],
|
|
120
|
+
}), _response.rawResponse);
|
|
115
121
|
case 504:
|
|
116
122
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
117
123
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -204,7 +210,13 @@ class Recordings {
|
|
|
204
210
|
breadcrumbsPrefix: ["response"],
|
|
205
211
|
}), _response.rawResponse);
|
|
206
212
|
case 500:
|
|
207
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
213
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
214
|
+
unrecognizedObjectKeys: "passthrough",
|
|
215
|
+
allowUnrecognizedUnionMembers: true,
|
|
216
|
+
allowUnrecognizedEnumValues: true,
|
|
217
|
+
skipValidation: true,
|
|
218
|
+
breadcrumbsPrefix: ["response"],
|
|
219
|
+
}), _response.rawResponse);
|
|
208
220
|
case 504:
|
|
209
221
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
210
222
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -282,7 +294,13 @@ class Recordings {
|
|
|
282
294
|
case 404:
|
|
283
295
|
throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
|
|
284
296
|
case 500:
|
|
285
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
297
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
298
|
+
unrecognizedObjectKeys: "passthrough",
|
|
299
|
+
allowUnrecognizedUnionMembers: true,
|
|
300
|
+
allowUnrecognizedEnumValues: true,
|
|
301
|
+
skipValidation: true,
|
|
302
|
+
breadcrumbsPrefix: ["response"],
|
|
303
|
+
}), _response.rawResponse);
|
|
286
304
|
case 504:
|
|
287
305
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
288
306
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -364,7 +382,13 @@ class Recordings {
|
|
|
364
382
|
case 404:
|
|
365
383
|
throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
|
|
366
384
|
case 500:
|
|
367
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
385
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
386
|
+
unrecognizedObjectKeys: "passthrough",
|
|
387
|
+
allowUnrecognizedUnionMembers: true,
|
|
388
|
+
allowUnrecognizedEnumValues: true,
|
|
389
|
+
skipValidation: true,
|
|
390
|
+
breadcrumbsPrefix: ["response"],
|
|
391
|
+
}), _response.rawResponse);
|
|
368
392
|
case 504:
|
|
369
393
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
370
394
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -7,7 +7,7 @@ export declare namespace StreamSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Corti.StreamConfigStatusMessage | Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage;
|
|
10
|
+
type Response = Corti.StreamConfigStatusMessage | Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -38,6 +38,7 @@ export declare class StreamSocket {
|
|
|
38
38
|
on<T extends keyof StreamSocket.EventHandlers>(event: T, callback: StreamSocket.EventHandlers[T]): void;
|
|
39
39
|
sendConfiguration(message: Corti.StreamConfigMessage): void;
|
|
40
40
|
sendAudio(message: string): void;
|
|
41
|
+
sendFlush(message: Corti.StreamFlushMessage): void;
|
|
41
42
|
sendEnd(message: Corti.StreamEndMessage): void;
|
|
42
43
|
/** Connect to the websocket and register event handlers. */
|
|
43
44
|
connect(): StreamSocket;
|
|
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
exports.StreamSocket = void 0;
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
50
50
|
const StreamConfigMessage_js_1 = require("../../../../serialization/types/StreamConfigMessage.js");
|
|
51
|
+
const StreamFlushMessage_js_1 = require("../../../../serialization/types/StreamFlushMessage.js");
|
|
51
52
|
const StreamEndMessage_js_1 = require("../../../../serialization/types/StreamEndMessage.js");
|
|
52
53
|
const json_js_1 = require("../../../../core/json.js");
|
|
53
54
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
@@ -120,9 +121,18 @@ class StreamSocket {
|
|
|
120
121
|
}
|
|
121
122
|
sendAudio(message) {
|
|
122
123
|
this.assertSocketIsOpen();
|
|
123
|
-
const jsonPayload = core.serialization
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const jsonPayload = core.serialization.string().jsonOrThrow(message, {
|
|
125
|
+
unrecognizedObjectKeys: "passthrough",
|
|
126
|
+
allowUnrecognizedUnionMembers: true,
|
|
127
|
+
allowUnrecognizedEnumValues: true,
|
|
128
|
+
skipValidation: true,
|
|
129
|
+
omitUndefined: true,
|
|
130
|
+
});
|
|
131
|
+
this.socket.send(JSON.stringify(jsonPayload));
|
|
132
|
+
}
|
|
133
|
+
sendFlush(message) {
|
|
134
|
+
this.assertSocketIsOpen();
|
|
135
|
+
const jsonPayload = StreamFlushMessage_js_1.StreamFlushMessage.jsonOrThrow(message, {
|
|
126
136
|
unrecognizedObjectKeys: "passthrough",
|
|
127
137
|
allowUnrecognizedUnionMembers: true,
|
|
128
138
|
allowUnrecognizedEnumValues: true,
|
|
@@ -120,7 +120,13 @@ class Templates {
|
|
|
120
120
|
case 401:
|
|
121
121
|
throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
122
122
|
case 500:
|
|
123
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
123
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
124
|
+
unrecognizedObjectKeys: "passthrough",
|
|
125
|
+
allowUnrecognizedUnionMembers: true,
|
|
126
|
+
allowUnrecognizedEnumValues: true,
|
|
127
|
+
skipValidation: true,
|
|
128
|
+
breadcrumbsPrefix: ["response"],
|
|
129
|
+
}), _response.rawResponse);
|
|
124
130
|
default:
|
|
125
131
|
throw new errors.CortiError({
|
|
126
132
|
statusCode: _response.error.statusCode,
|
|
@@ -219,7 +225,13 @@ class Templates {
|
|
|
219
225
|
case 401:
|
|
220
226
|
throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
221
227
|
case 500:
|
|
222
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
228
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
229
|
+
unrecognizedObjectKeys: "passthrough",
|
|
230
|
+
allowUnrecognizedUnionMembers: true,
|
|
231
|
+
allowUnrecognizedEnumValues: true,
|
|
232
|
+
skipValidation: true,
|
|
233
|
+
breadcrumbsPrefix: ["response"],
|
|
234
|
+
}), _response.rawResponse);
|
|
223
235
|
default:
|
|
224
236
|
throw new errors.CortiError({
|
|
225
237
|
statusCode: _response.error.statusCode,
|
|
@@ -291,7 +303,13 @@ class Templates {
|
|
|
291
303
|
case 401:
|
|
292
304
|
throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
293
305
|
case 500:
|
|
294
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
306
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
307
|
+
unrecognizedObjectKeys: "passthrough",
|
|
308
|
+
allowUnrecognizedUnionMembers: true,
|
|
309
|
+
allowUnrecognizedEnumValues: true,
|
|
310
|
+
skipValidation: true,
|
|
311
|
+
breadcrumbsPrefix: ["response"],
|
|
312
|
+
}), _response.rawResponse);
|
|
295
313
|
default:
|
|
296
314
|
throw new errors.CortiError({
|
|
297
315
|
statusCode: _response.error.statusCode,
|
|
@@ -7,7 +7,7 @@ export declare namespace TranscribeSocket {
|
|
|
7
7
|
interface Args {
|
|
8
8
|
socket: core.ReconnectingWebSocket;
|
|
9
9
|
}
|
|
10
|
-
type Response = Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage;
|
|
10
|
+
type Response = Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage;
|
|
11
11
|
type EventHandlers = {
|
|
12
12
|
open?: () => void;
|
|
13
13
|
message?: (message: Response) => void;
|
|
@@ -38,6 +38,7 @@ export declare class TranscribeSocket {
|
|
|
38
38
|
on<T extends keyof TranscribeSocket.EventHandlers>(event: T, callback: TranscribeSocket.EventHandlers[T]): void;
|
|
39
39
|
sendConfiguration(message: Corti.TranscribeConfigMessage): void;
|
|
40
40
|
sendAudio(message: string): void;
|
|
41
|
+
sendFlush(message: Corti.TranscribeFlushMessage): void;
|
|
41
42
|
sendEnd(message: Corti.TranscribeEndMessage): void;
|
|
42
43
|
/** Connect to the websocket and register event handlers. */
|
|
43
44
|
connect(): TranscribeSocket;
|
|
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
exports.TranscribeSocket = void 0;
|
|
49
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
50
50
|
const TranscribeConfigMessage_js_1 = require("../../../../serialization/types/TranscribeConfigMessage.js");
|
|
51
|
+
const TranscribeFlushMessage_js_1 = require("../../../../serialization/types/TranscribeFlushMessage.js");
|
|
51
52
|
const TranscribeEndMessage_js_1 = require("../../../../serialization/types/TranscribeEndMessage.js");
|
|
52
53
|
const json_js_1 = require("../../../../core/json.js");
|
|
53
54
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
@@ -120,9 +121,18 @@ class TranscribeSocket {
|
|
|
120
121
|
}
|
|
121
122
|
sendAudio(message) {
|
|
122
123
|
this.assertSocketIsOpen();
|
|
123
|
-
const jsonPayload = core.serialization
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
const jsonPayload = core.serialization.string().jsonOrThrow(message, {
|
|
125
|
+
unrecognizedObjectKeys: "passthrough",
|
|
126
|
+
allowUnrecognizedUnionMembers: true,
|
|
127
|
+
allowUnrecognizedEnumValues: true,
|
|
128
|
+
skipValidation: true,
|
|
129
|
+
omitUndefined: true,
|
|
130
|
+
});
|
|
131
|
+
this.socket.send(JSON.stringify(jsonPayload));
|
|
132
|
+
}
|
|
133
|
+
sendFlush(message) {
|
|
134
|
+
this.assertSocketIsOpen();
|
|
135
|
+
const jsonPayload = TranscribeFlushMessage_js_1.TranscribeFlushMessage.jsonOrThrow(message, {
|
|
126
136
|
unrecognizedObjectKeys: "passthrough",
|
|
127
137
|
allowUnrecognizedUnionMembers: true,
|
|
128
138
|
allowUnrecognizedEnumValues: true,
|
|
@@ -121,7 +121,13 @@ class Transcripts {
|
|
|
121
121
|
breadcrumbsPrefix: ["response"],
|
|
122
122
|
}), _response.rawResponse);
|
|
123
123
|
case 500:
|
|
124
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
124
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
125
|
+
unrecognizedObjectKeys: "passthrough",
|
|
126
|
+
allowUnrecognizedUnionMembers: true,
|
|
127
|
+
allowUnrecognizedEnumValues: true,
|
|
128
|
+
skipValidation: true,
|
|
129
|
+
breadcrumbsPrefix: ["response"],
|
|
130
|
+
}), _response.rawResponse);
|
|
125
131
|
case 504:
|
|
126
132
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
127
133
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -224,7 +230,13 @@ class Transcripts {
|
|
|
224
230
|
breadcrumbsPrefix: ["response"],
|
|
225
231
|
}), _response.rawResponse);
|
|
226
232
|
case 500:
|
|
227
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
233
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
234
|
+
unrecognizedObjectKeys: "passthrough",
|
|
235
|
+
allowUnrecognizedUnionMembers: true,
|
|
236
|
+
allowUnrecognizedEnumValues: true,
|
|
237
|
+
skipValidation: true,
|
|
238
|
+
breadcrumbsPrefix: ["response"],
|
|
239
|
+
}), _response.rawResponse);
|
|
228
240
|
case 504:
|
|
229
241
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
230
242
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -318,7 +330,13 @@ class Transcripts {
|
|
|
318
330
|
breadcrumbsPrefix: ["response"],
|
|
319
331
|
}), _response.rawResponse);
|
|
320
332
|
case 500:
|
|
321
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
333
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
334
|
+
unrecognizedObjectKeys: "passthrough",
|
|
335
|
+
allowUnrecognizedUnionMembers: true,
|
|
336
|
+
allowUnrecognizedEnumValues: true,
|
|
337
|
+
skipValidation: true,
|
|
338
|
+
breadcrumbsPrefix: ["response"],
|
|
339
|
+
}), _response.rawResponse);
|
|
322
340
|
case 504:
|
|
323
341
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
324
342
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -403,7 +421,13 @@ class Transcripts {
|
|
|
403
421
|
breadcrumbsPrefix: ["response"],
|
|
404
422
|
}), _response.rawResponse);
|
|
405
423
|
case 500:
|
|
406
|
-
throw new Corti.InternalServerError(_response.error.body,
|
|
424
|
+
throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
425
|
+
unrecognizedObjectKeys: "passthrough",
|
|
426
|
+
allowUnrecognizedUnionMembers: true,
|
|
427
|
+
allowUnrecognizedEnumValues: true,
|
|
428
|
+
skipValidation: true,
|
|
429
|
+
breadcrumbsPrefix: ["response"],
|
|
430
|
+
}), _response.rawResponse);
|
|
407
431
|
case 504:
|
|
408
432
|
throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
|
|
409
433
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -71,6 +71,7 @@ export * from "./StreamConfigMode.js";
|
|
|
71
71
|
export * from "./StreamConfigStatusMessageType.js";
|
|
72
72
|
export * from "./StreamConfigStatusMessage.js";
|
|
73
73
|
export * from "./StreamEndedMessage.js";
|
|
74
|
+
export * from "./StreamFlushedMessage.js";
|
|
74
75
|
export * from "./StreamUsageMessage.js";
|
|
75
76
|
export * from "./StreamErrorMessage.js";
|
|
76
77
|
export * from "./StreamErrorDetail.js";
|
|
@@ -83,6 +84,7 @@ export * from "./StreamTranscriptTime.js";
|
|
|
83
84
|
export * from "./StreamFactsMessage.js";
|
|
84
85
|
export * from "./StreamFact.js";
|
|
85
86
|
export * from "./StreamEndMessage.js";
|
|
87
|
+
export * from "./StreamFlushMessage.js";
|
|
86
88
|
export * from "./StreamSupportedLanguage.js";
|
|
87
89
|
export * from "./TranscribeSupportedLanguage.js";
|
|
88
90
|
export * from "./TranscribeConfig.js";
|
|
@@ -92,8 +94,10 @@ export * from "./TranscribeCommandVariable.js";
|
|
|
92
94
|
export * from "./TranscribeConfigStatusMessageType.js";
|
|
93
95
|
export * from "./TranscribeConfigStatusMessage.js";
|
|
94
96
|
export * from "./TranscribeEndMessage.js";
|
|
97
|
+
export * from "./TranscribeFlushMessage.js";
|
|
95
98
|
export * from "./TranscribeUsageMessage.js";
|
|
96
99
|
export * from "./TranscribeEndedMessage.js";
|
|
100
|
+
export * from "./TranscribeFlushedMessage.js";
|
|
97
101
|
export * from "./TranscribeErrorMessageError.js";
|
|
98
102
|
export * from "./TranscribeErrorMessage.js";
|
|
99
103
|
export * from "./TranscribeTranscriptData.js";
|
|
@@ -87,6 +87,7 @@ __exportStar(require("./StreamConfigMode.js"), exports);
|
|
|
87
87
|
__exportStar(require("./StreamConfigStatusMessageType.js"), exports);
|
|
88
88
|
__exportStar(require("./StreamConfigStatusMessage.js"), exports);
|
|
89
89
|
__exportStar(require("./StreamEndedMessage.js"), exports);
|
|
90
|
+
__exportStar(require("./StreamFlushedMessage.js"), exports);
|
|
90
91
|
__exportStar(require("./StreamUsageMessage.js"), exports);
|
|
91
92
|
__exportStar(require("./StreamErrorMessage.js"), exports);
|
|
92
93
|
__exportStar(require("./StreamErrorDetail.js"), exports);
|
|
@@ -99,6 +100,7 @@ __exportStar(require("./StreamTranscriptTime.js"), exports);
|
|
|
99
100
|
__exportStar(require("./StreamFactsMessage.js"), exports);
|
|
100
101
|
__exportStar(require("./StreamFact.js"), exports);
|
|
101
102
|
__exportStar(require("./StreamEndMessage.js"), exports);
|
|
103
|
+
__exportStar(require("./StreamFlushMessage.js"), exports);
|
|
102
104
|
__exportStar(require("./StreamSupportedLanguage.js"), exports);
|
|
103
105
|
__exportStar(require("./TranscribeSupportedLanguage.js"), exports);
|
|
104
106
|
__exportStar(require("./TranscribeConfig.js"), exports);
|
|
@@ -108,8 +110,10 @@ __exportStar(require("./TranscribeCommandVariable.js"), exports);
|
|
|
108
110
|
__exportStar(require("./TranscribeConfigStatusMessageType.js"), exports);
|
|
109
111
|
__exportStar(require("./TranscribeConfigStatusMessage.js"), exports);
|
|
110
112
|
__exportStar(require("./TranscribeEndMessage.js"), exports);
|
|
113
|
+
__exportStar(require("./TranscribeFlushMessage.js"), exports);
|
|
111
114
|
__exportStar(require("./TranscribeUsageMessage.js"), exports);
|
|
112
115
|
__exportStar(require("./TranscribeEndedMessage.js"), exports);
|
|
116
|
+
__exportStar(require("./TranscribeFlushedMessage.js"), exports);
|
|
113
117
|
__exportStar(require("./TranscribeErrorMessageError.js"), exports);
|
|
114
118
|
__exportStar(require("./TranscribeErrorMessage.js"), exports);
|
|
115
119
|
__exportStar(require("./TranscribeTranscriptData.js"), exports);
|
|
@@ -60,7 +60,7 @@ interface AuthorizationRefreshServer {
|
|
|
60
60
|
interface Options {
|
|
61
61
|
skipRedirect?: boolean;
|
|
62
62
|
}
|
|
63
|
-
type AuthOptions = Omit<FernAuth.Options,
|
|
63
|
+
type AuthOptions = Omit<FernAuth.Options, "environment"> & {
|
|
64
64
|
environment: core.Supplier<environments.CortiEnvironment | environments.CortiEnvironmentUrls> | string;
|
|
65
65
|
};
|
|
66
66
|
export declare class Auth extends FernAuth {
|
|
@@ -71,7 +71,7 @@ export declare class Auth extends FernAuth {
|
|
|
71
71
|
/**
|
|
72
72
|
* Patch: Generate PKCE authorization URL with automatic code verifier generation
|
|
73
73
|
*/
|
|
74
|
-
authorizePkceUrl({ clientId, redirectUri
|
|
74
|
+
authorizePkceUrl({ clientId, redirectUri }: AuthorizationCodeClient, options?: Options): Promise<string>;
|
|
75
75
|
/**
|
|
76
76
|
* Patch: Get the stored PKCE code verifier
|
|
77
77
|
*/
|
|
@@ -83,7 +83,7 @@ export declare class Auth extends FernAuth {
|
|
|
83
83
|
/**
|
|
84
84
|
* Patch: added method to get Authorization URL for Authorization code flow and PKCE flow
|
|
85
85
|
*/
|
|
86
|
-
authorizeURL({ clientId, redirectUri, codeChallenge
|
|
86
|
+
authorizeURL({ clientId, redirectUri, codeChallenge }: AuthorizationCodeClient, options?: Options): Promise<string>;
|
|
87
87
|
/**
|
|
88
88
|
* Patch: calls __getToken_custom with additional fields to support Authorization code flow
|
|
89
89
|
*/
|
|
@@ -78,7 +78,7 @@ class Auth extends Client_js_1.Auth {
|
|
|
78
78
|
* Patch: Generate PKCE authorization URL with automatic code verifier generation
|
|
79
79
|
*/
|
|
80
80
|
authorizePkceUrl(_a, options_1) {
|
|
81
|
-
return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri
|
|
81
|
+
return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri }, options) {
|
|
82
82
|
const codeVerifier = (0, pkce_js_1.generateCodeVerifier)();
|
|
83
83
|
(0, localStorage_js_1.setLocalStorageItem)(CODE_VERIFIER_KEY, codeVerifier);
|
|
84
84
|
const codeChallenge = yield (0, pkce_js_1.generateCodeChallenge)(codeVerifier);
|
|
@@ -105,20 +105,20 @@ class Auth extends Client_js_1.Auth {
|
|
|
105
105
|
* Patch: added method to get Authorization URL for Authorization code flow and PKCE flow
|
|
106
106
|
*/
|
|
107
107
|
authorizeURL(_a, options_1) {
|
|
108
|
-
return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri, codeChallenge
|
|
108
|
+
return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri, codeChallenge }, options) {
|
|
109
109
|
var _b;
|
|
110
110
|
const authUrl = new URL(core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)).login, yield core.Supplier.get(this._options.tenantName), "protocol/openid-connect/auth"));
|
|
111
|
-
authUrl.searchParams.set(
|
|
112
|
-
authUrl.searchParams.set(
|
|
111
|
+
authUrl.searchParams.set("response_type", "code");
|
|
112
|
+
authUrl.searchParams.set("scope", "openid profile");
|
|
113
113
|
if (clientId !== undefined) {
|
|
114
|
-
authUrl.searchParams.set(
|
|
114
|
+
authUrl.searchParams.set("client_id", clientId);
|
|
115
115
|
}
|
|
116
116
|
if (redirectUri !== undefined) {
|
|
117
|
-
authUrl.searchParams.set(
|
|
117
|
+
authUrl.searchParams.set("redirect_uri", redirectUri);
|
|
118
118
|
}
|
|
119
119
|
if (codeChallenge !== undefined) {
|
|
120
|
-
authUrl.searchParams.set(
|
|
121
|
-
authUrl.searchParams.set(
|
|
120
|
+
authUrl.searchParams.set("code_challenge", codeChallenge);
|
|
121
|
+
authUrl.searchParams.set("code_challenge_method", "S256");
|
|
122
122
|
}
|
|
123
123
|
const authUrlString = authUrl.toString();
|
|
124
124
|
if (typeof window !== "undefined" && !(options === null || options === void 0 ? void 0 : options.skipRedirect)) {
|
|
@@ -142,8 +142,8 @@ class Auth extends Client_js_1.Auth {
|
|
|
142
142
|
if (!codeVerifier) {
|
|
143
143
|
throw new ParseError_js_1.ParseError([
|
|
144
144
|
{
|
|
145
|
-
path: [
|
|
146
|
-
message:
|
|
145
|
+
path: ["codeVerifier"],
|
|
146
|
+
message: "Code verifier was not provided and not found in localStorage.",
|
|
147
147
|
},
|
|
148
148
|
]);
|
|
149
149
|
}
|
|
@@ -108,16 +108,17 @@ class CortiClient {
|
|
|
108
108
|
/**
|
|
109
109
|
* Patch: if `clientId` is provided, use OAuthTokenProvider, otherwise use BearerProvider
|
|
110
110
|
*/
|
|
111
|
-
this._oauthTokenProvider =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
this._oauthTokenProvider =
|
|
112
|
+
"clientId" in _options.auth
|
|
113
|
+
? new core.OAuthTokenProvider({
|
|
114
|
+
clientId: _options.auth.clientId,
|
|
115
|
+
clientSecret: _options.auth.clientSecret,
|
|
116
|
+
/**
|
|
117
|
+
* Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
|
|
118
|
+
*/
|
|
119
|
+
authClient: new CortiAuth_js_1.Auth(this._options),
|
|
120
|
+
})
|
|
121
|
+
: new RefreshBearerProvider_js_1.RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
|
|
121
122
|
}
|
|
122
123
|
get interactions() {
|
|
123
124
|
var _a;
|