@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.
Files changed (110) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/errors/InternalServerError.d.ts +2 -1
  4. package/dist/cjs/api/resources/documents/client/Client.js +35 -5
  5. package/dist/cjs/api/resources/facts/client/Client.js +7 -1
  6. package/dist/cjs/api/resources/interactions/client/Client.js +7 -1
  7. package/dist/cjs/api/resources/recordings/client/Client.js +28 -4
  8. package/dist/cjs/api/resources/stream/client/Socket.d.ts +2 -1
  9. package/dist/cjs/api/resources/stream/client/Socket.js +13 -3
  10. package/dist/cjs/api/resources/templates/client/Client.js +21 -3
  11. package/dist/cjs/api/resources/transcribe/client/Socket.d.ts +2 -1
  12. package/dist/cjs/api/resources/transcribe/client/Socket.js +13 -3
  13. package/dist/cjs/api/resources/transcripts/client/Client.js +28 -4
  14. package/dist/cjs/api/types/StreamFlushMessage.d.ts +6 -0
  15. package/dist/cjs/api/types/StreamFlushMessage.js +5 -0
  16. package/dist/cjs/api/types/StreamFlushedMessage.d.ts +6 -0
  17. package/dist/cjs/api/types/StreamFlushedMessage.js +5 -0
  18. package/dist/cjs/api/types/TranscribeFlushMessage.d.ts +6 -0
  19. package/dist/cjs/api/types/TranscribeFlushMessage.js +5 -0
  20. package/dist/cjs/api/types/TranscribeFlushedMessage.d.ts +6 -0
  21. package/dist/cjs/api/types/TranscribeFlushedMessage.js +5 -0
  22. package/dist/cjs/api/types/index.d.ts +4 -0
  23. package/dist/cjs/api/types/index.js +4 -0
  24. package/dist/cjs/custom/CortiAuth.d.ts +3 -3
  25. package/dist/cjs/custom/CortiAuth.js +10 -10
  26. package/dist/cjs/custom/CortiClient.js +11 -10
  27. package/dist/cjs/custom/CustomStream.d.ts +1 -1
  28. package/dist/cjs/custom/CustomStream.js +15 -14
  29. package/dist/cjs/custom/CustomStreamSocket.d.ts +1 -1
  30. package/dist/cjs/custom/CustomStreamSocket.js +1 -1
  31. package/dist/cjs/custom/CustomTranscribe.d.ts +1 -1
  32. package/dist/cjs/custom/CustomTranscribe.js +12 -12
  33. package/dist/cjs/custom/CustomTranscribeSocket.d.ts +1 -1
  34. package/dist/cjs/custom/CustomTranscribeSocket.js +1 -1
  35. package/dist/cjs/custom/RefreshBearerProvider.d.ts +1 -1
  36. package/dist/cjs/custom/utils/decodeToken.js +6 -8
  37. package/dist/cjs/custom/utils/localStorage.js +3 -1
  38. package/dist/cjs/custom/utils/pkce.js +2 -5
  39. package/dist/cjs/custom/utils/resolveClientOptions.js +1 -2
  40. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.d.ts +3 -2
  41. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.js +2 -0
  42. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.ts +3 -2
  43. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.js +2 -0
  44. package/dist/cjs/serialization/types/StreamFlushMessage.d.ts +12 -0
  45. package/dist/cjs/serialization/types/StreamFlushMessage.js +43 -0
  46. package/dist/cjs/serialization/types/StreamFlushedMessage.d.ts +12 -0
  47. package/dist/cjs/serialization/types/StreamFlushedMessage.js +43 -0
  48. package/dist/cjs/serialization/types/TranscribeFlushMessage.d.ts +12 -0
  49. package/dist/cjs/serialization/types/TranscribeFlushMessage.js +43 -0
  50. package/dist/cjs/serialization/types/TranscribeFlushedMessage.d.ts +12 -0
  51. package/dist/cjs/serialization/types/TranscribeFlushedMessage.js +43 -0
  52. package/dist/cjs/serialization/types/index.d.ts +4 -0
  53. package/dist/cjs/serialization/types/index.js +4 -0
  54. package/dist/cjs/version.d.ts +1 -1
  55. package/dist/cjs/version.js +1 -1
  56. package/dist/esm/Client.mjs +2 -2
  57. package/dist/esm/api/errors/InternalServerError.d.mts +2 -1
  58. package/dist/esm/api/resources/documents/client/Client.mjs +35 -5
  59. package/dist/esm/api/resources/facts/client/Client.mjs +7 -1
  60. package/dist/esm/api/resources/interactions/client/Client.mjs +7 -1
  61. package/dist/esm/api/resources/recordings/client/Client.mjs +28 -4
  62. package/dist/esm/api/resources/stream/client/Socket.d.mts +2 -1
  63. package/dist/esm/api/resources/stream/client/Socket.mjs +13 -3
  64. package/dist/esm/api/resources/templates/client/Client.mjs +21 -3
  65. package/dist/esm/api/resources/transcribe/client/Socket.d.mts +2 -1
  66. package/dist/esm/api/resources/transcribe/client/Socket.mjs +13 -3
  67. package/dist/esm/api/resources/transcripts/client/Client.mjs +28 -4
  68. package/dist/esm/api/types/StreamFlushMessage.d.mts +6 -0
  69. package/dist/esm/api/types/StreamFlushMessage.mjs +4 -0
  70. package/dist/esm/api/types/StreamFlushedMessage.d.mts +6 -0
  71. package/dist/esm/api/types/StreamFlushedMessage.mjs +4 -0
  72. package/dist/esm/api/types/TranscribeFlushMessage.d.mts +6 -0
  73. package/dist/esm/api/types/TranscribeFlushMessage.mjs +4 -0
  74. package/dist/esm/api/types/TranscribeFlushedMessage.d.mts +6 -0
  75. package/dist/esm/api/types/TranscribeFlushedMessage.mjs +4 -0
  76. package/dist/esm/api/types/index.d.mts +4 -0
  77. package/dist/esm/api/types/index.mjs +4 -0
  78. package/dist/esm/custom/CortiAuth.d.mts +3 -3
  79. package/dist/esm/custom/CortiAuth.mjs +10 -10
  80. package/dist/esm/custom/CortiClient.mjs +11 -10
  81. package/dist/esm/custom/CustomStream.d.mts +1 -1
  82. package/dist/esm/custom/CustomStream.mjs +15 -14
  83. package/dist/esm/custom/CustomStreamSocket.d.mts +1 -1
  84. package/dist/esm/custom/CustomStreamSocket.mjs +2 -2
  85. package/dist/esm/custom/CustomTranscribe.d.mts +1 -1
  86. package/dist/esm/custom/CustomTranscribe.mjs +12 -12
  87. package/dist/esm/custom/CustomTranscribeSocket.d.mts +1 -1
  88. package/dist/esm/custom/CustomTranscribeSocket.mjs +2 -2
  89. package/dist/esm/custom/RefreshBearerProvider.d.mts +1 -1
  90. package/dist/esm/custom/utils/decodeToken.mjs +6 -8
  91. package/dist/esm/custom/utils/localStorage.mjs +3 -1
  92. package/dist/esm/custom/utils/pkce.mjs +2 -5
  93. package/dist/esm/custom/utils/resolveClientOptions.mjs +1 -2
  94. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.d.mts +3 -2
  95. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.mjs +2 -0
  96. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.mts +3 -2
  97. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.mjs +2 -0
  98. package/dist/esm/serialization/types/StreamFlushMessage.d.mts +12 -0
  99. package/dist/esm/serialization/types/StreamFlushMessage.mjs +7 -0
  100. package/dist/esm/serialization/types/StreamFlushedMessage.d.mts +12 -0
  101. package/dist/esm/serialization/types/StreamFlushedMessage.mjs +7 -0
  102. package/dist/esm/serialization/types/TranscribeFlushMessage.d.mts +12 -0
  103. package/dist/esm/serialization/types/TranscribeFlushMessage.mjs +7 -0
  104. package/dist/esm/serialization/types/TranscribeFlushedMessage.d.mts +12 -0
  105. package/dist/esm/serialization/types/TranscribeFlushedMessage.mjs +7 -0
  106. package/dist/esm/serialization/types/index.d.mts +4 -0
  107. package/dist/esm/serialization/types/index.mjs +4 -0
  108. package/dist/esm/version.d.mts +1 -1
  109. package/dist/esm/version.mjs +1 -1
  110. package/package.json +1 -1
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.6.1";
1
+ export declare const SDK_VERSION = "0.7.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.6.1";
4
+ exports.SDK_VERSION = "0.7.0";
@@ -28,8 +28,8 @@ export class CortiClient {
28
28
  "Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
29
29
  "X-Fern-Language": "JavaScript",
30
30
  "X-Fern-SDK-Name": "@corti/sdk",
31
- "X-Fern-SDK-Version": "0.6.1",
32
- "User-Agent": "@corti/sdk/0.6.1",
31
+ "X-Fern-SDK-Version": "0.7.0",
32
+ "User-Agent": "@corti/sdk/0.7.0",
33
33
  "X-Fern-Runtime": core.RUNTIME.type,
34
34
  "X-Fern-Runtime-Version": core.RUNTIME.version,
35
35
  }, _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.mjs";
5
+ import * as Corti from "../index.mjs";
5
6
  import * as core from "../../core/index.mjs";
6
7
  export declare class InternalServerError extends errors.CortiError {
7
- constructor(body?: unknown, rawResponse?: core.RawResponse);
8
+ constructor(body: Corti.ErrorResponse, rawResponse?: core.RawResponse);
8
9
  }
@@ -75,7 +75,13 @@ export class Documents {
75
75
  breadcrumbsPrefix: ["response"],
76
76
  }), _response.rawResponse);
77
77
  case 500:
78
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
78
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
79
+ unrecognizedObjectKeys: "passthrough",
80
+ allowUnrecognizedUnionMembers: true,
81
+ allowUnrecognizedEnumValues: true,
82
+ skipValidation: true,
83
+ breadcrumbsPrefix: ["response"],
84
+ }), _response.rawResponse);
79
85
  case 504:
80
86
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
81
87
  unrecognizedObjectKeys: "passthrough",
@@ -182,7 +188,13 @@ export class Documents {
182
188
  breadcrumbsPrefix: ["response"],
183
189
  }), _response.rawResponse);
184
190
  case 500:
185
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
191
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
192
+ unrecognizedObjectKeys: "passthrough",
193
+ allowUnrecognizedUnionMembers: true,
194
+ allowUnrecognizedEnumValues: true,
195
+ skipValidation: true,
196
+ breadcrumbsPrefix: ["response"],
197
+ }), _response.rawResponse);
186
198
  case 504:
187
199
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
188
200
  unrecognizedObjectKeys: "passthrough",
@@ -273,7 +285,13 @@ export class Documents {
273
285
  breadcrumbsPrefix: ["response"],
274
286
  }), _response.rawResponse);
275
287
  case 500:
276
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
288
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
289
+ unrecognizedObjectKeys: "passthrough",
290
+ allowUnrecognizedUnionMembers: true,
291
+ allowUnrecognizedEnumValues: true,
292
+ skipValidation: true,
293
+ breadcrumbsPrefix: ["response"],
294
+ }), _response.rawResponse);
277
295
  case 504:
278
296
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
279
297
  unrecognizedObjectKeys: "passthrough",
@@ -353,7 +371,13 @@ export class Documents {
353
371
  case 404:
354
372
  throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
355
373
  case 500:
356
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
374
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
375
+ unrecognizedObjectKeys: "passthrough",
376
+ allowUnrecognizedUnionMembers: true,
377
+ allowUnrecognizedEnumValues: true,
378
+ skipValidation: true,
379
+ breadcrumbsPrefix: ["response"],
380
+ }), _response.rawResponse);
357
381
  case 504:
358
382
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
359
383
  unrecognizedObjectKeys: "passthrough",
@@ -449,7 +473,13 @@ export class Documents {
449
473
  breadcrumbsPrefix: ["response"],
450
474
  }), _response.rawResponse);
451
475
  case 500:
452
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
476
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
477
+ unrecognizedObjectKeys: "passthrough",
478
+ allowUnrecognizedUnionMembers: true,
479
+ allowUnrecognizedEnumValues: true,
480
+ skipValidation: true,
481
+ breadcrumbsPrefix: ["response"],
482
+ }), _response.rawResponse);
453
483
  case 504:
454
484
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
455
485
  unrecognizedObjectKeys: "passthrough",
@@ -61,7 +61,13 @@ export class Facts {
61
61
  if (_response.error.reason === "status-code") {
62
62
  switch (_response.error.statusCode) {
63
63
  case 500:
64
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
64
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
65
+ unrecognizedObjectKeys: "passthrough",
66
+ allowUnrecognizedUnionMembers: true,
67
+ allowUnrecognizedEnumValues: true,
68
+ skipValidation: true,
69
+ breadcrumbsPrefix: ["response"],
70
+ }), _response.rawResponse);
65
71
  default:
66
72
  throw new errors.CortiError({
67
73
  statusCode: _response.error.statusCode,
@@ -217,7 +217,13 @@ export class Interactions {
217
217
  breadcrumbsPrefix: ["response"],
218
218
  }), _response.rawResponse);
219
219
  case 500:
220
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
220
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
221
+ unrecognizedObjectKeys: "passthrough",
222
+ allowUnrecognizedUnionMembers: true,
223
+ allowUnrecognizedEnumValues: true,
224
+ skipValidation: true,
225
+ breadcrumbsPrefix: ["response"],
226
+ }), _response.rawResponse);
221
227
  case 504:
222
228
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
223
229
  unrecognizedObjectKeys: "passthrough",
@@ -75,7 +75,13 @@ export class Recordings {
75
75
  breadcrumbsPrefix: ["response"],
76
76
  }), _response.rawResponse);
77
77
  case 500:
78
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
78
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
79
+ unrecognizedObjectKeys: "passthrough",
80
+ allowUnrecognizedUnionMembers: true,
81
+ allowUnrecognizedEnumValues: true,
82
+ skipValidation: true,
83
+ breadcrumbsPrefix: ["response"],
84
+ }), _response.rawResponse);
79
85
  case 504:
80
86
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
81
87
  unrecognizedObjectKeys: "passthrough",
@@ -168,7 +174,13 @@ export class Recordings {
168
174
  breadcrumbsPrefix: ["response"],
169
175
  }), _response.rawResponse);
170
176
  case 500:
171
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
177
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
178
+ unrecognizedObjectKeys: "passthrough",
179
+ allowUnrecognizedUnionMembers: true,
180
+ allowUnrecognizedEnumValues: true,
181
+ skipValidation: true,
182
+ breadcrumbsPrefix: ["response"],
183
+ }), _response.rawResponse);
172
184
  case 504:
173
185
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
174
186
  unrecognizedObjectKeys: "passthrough",
@@ -246,7 +258,13 @@ export class Recordings {
246
258
  case 404:
247
259
  throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
248
260
  case 500:
249
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
261
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
262
+ unrecognizedObjectKeys: "passthrough",
263
+ allowUnrecognizedUnionMembers: true,
264
+ allowUnrecognizedEnumValues: true,
265
+ skipValidation: true,
266
+ breadcrumbsPrefix: ["response"],
267
+ }), _response.rawResponse);
250
268
  case 504:
251
269
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
252
270
  unrecognizedObjectKeys: "passthrough",
@@ -328,7 +346,13 @@ export class Recordings {
328
346
  case 404:
329
347
  throw new Corti.NotFoundError(_response.error.body, _response.rawResponse);
330
348
  case 500:
331
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
349
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
350
+ unrecognizedObjectKeys: "passthrough",
351
+ allowUnrecognizedUnionMembers: true,
352
+ allowUnrecognizedEnumValues: true,
353
+ skipValidation: true,
354
+ breadcrumbsPrefix: ["response"],
355
+ }), _response.rawResponse);
332
356
  case 504:
333
357
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
334
358
  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;
@@ -12,6 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
12
  };
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import { StreamConfigMessage } from "../../../../serialization/types/StreamConfigMessage.mjs";
15
+ import { StreamFlushMessage } from "../../../../serialization/types/StreamFlushMessage.mjs";
15
16
  import { StreamEndMessage } from "../../../../serialization/types/StreamEndMessage.mjs";
16
17
  import { fromJson } from "../../../../core/json.mjs";
17
18
  import * as serializers from "../../../../serialization/index.mjs";
@@ -84,9 +85,18 @@ export class StreamSocket {
84
85
  }
85
86
  sendAudio(message) {
86
87
  this.assertSocketIsOpen();
87
- const jsonPayload = core.serialization
88
- .string()
89
- .jsonOrThrow(message, {
88
+ const jsonPayload = core.serialization.string().jsonOrThrow(message, {
89
+ unrecognizedObjectKeys: "passthrough",
90
+ allowUnrecognizedUnionMembers: true,
91
+ allowUnrecognizedEnumValues: true,
92
+ skipValidation: true,
93
+ omitUndefined: true,
94
+ });
95
+ this.socket.send(JSON.stringify(jsonPayload));
96
+ }
97
+ sendFlush(message) {
98
+ this.assertSocketIsOpen();
99
+ const jsonPayload = StreamFlushMessage.jsonOrThrow(message, {
90
100
  unrecognizedObjectKeys: "passthrough",
91
101
  allowUnrecognizedUnionMembers: true,
92
102
  allowUnrecognizedEnumValues: true,
@@ -84,7 +84,13 @@ export class Templates {
84
84
  case 401:
85
85
  throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
86
86
  case 500:
87
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
87
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
88
+ unrecognizedObjectKeys: "passthrough",
89
+ allowUnrecognizedUnionMembers: true,
90
+ allowUnrecognizedEnumValues: true,
91
+ skipValidation: true,
92
+ breadcrumbsPrefix: ["response"],
93
+ }), _response.rawResponse);
88
94
  default:
89
95
  throw new errors.CortiError({
90
96
  statusCode: _response.error.statusCode,
@@ -183,7 +189,13 @@ export class Templates {
183
189
  case 401:
184
190
  throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
185
191
  case 500:
186
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
192
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
193
+ unrecognizedObjectKeys: "passthrough",
194
+ allowUnrecognizedUnionMembers: true,
195
+ allowUnrecognizedEnumValues: true,
196
+ skipValidation: true,
197
+ breadcrumbsPrefix: ["response"],
198
+ }), _response.rawResponse);
187
199
  default:
188
200
  throw new errors.CortiError({
189
201
  statusCode: _response.error.statusCode,
@@ -255,7 +267,13 @@ export class Templates {
255
267
  case 401:
256
268
  throw new Corti.UnauthorizedError(_response.error.body, _response.rawResponse);
257
269
  case 500:
258
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
270
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
271
+ unrecognizedObjectKeys: "passthrough",
272
+ allowUnrecognizedUnionMembers: true,
273
+ allowUnrecognizedEnumValues: true,
274
+ skipValidation: true,
275
+ breadcrumbsPrefix: ["response"],
276
+ }), _response.rawResponse);
259
277
  default:
260
278
  throw new errors.CortiError({
261
279
  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;
@@ -12,6 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
12
  };
13
13
  import * as core from "../../../../core/index.mjs";
14
14
  import { TranscribeConfigMessage } from "../../../../serialization/types/TranscribeConfigMessage.mjs";
15
+ import { TranscribeFlushMessage } from "../../../../serialization/types/TranscribeFlushMessage.mjs";
15
16
  import { TranscribeEndMessage } from "../../../../serialization/types/TranscribeEndMessage.mjs";
16
17
  import { fromJson } from "../../../../core/json.mjs";
17
18
  import * as serializers from "../../../../serialization/index.mjs";
@@ -84,9 +85,18 @@ export class TranscribeSocket {
84
85
  }
85
86
  sendAudio(message) {
86
87
  this.assertSocketIsOpen();
87
- const jsonPayload = core.serialization
88
- .string()
89
- .jsonOrThrow(message, {
88
+ const jsonPayload = core.serialization.string().jsonOrThrow(message, {
89
+ unrecognizedObjectKeys: "passthrough",
90
+ allowUnrecognizedUnionMembers: true,
91
+ allowUnrecognizedEnumValues: true,
92
+ skipValidation: true,
93
+ omitUndefined: true,
94
+ });
95
+ this.socket.send(JSON.stringify(jsonPayload));
96
+ }
97
+ sendFlush(message) {
98
+ this.assertSocketIsOpen();
99
+ const jsonPayload = TranscribeFlushMessage.jsonOrThrow(message, {
90
100
  unrecognizedObjectKeys: "passthrough",
91
101
  allowUnrecognizedUnionMembers: true,
92
102
  allowUnrecognizedEnumValues: true,
@@ -85,7 +85,13 @@ export class Transcripts {
85
85
  breadcrumbsPrefix: ["response"],
86
86
  }), _response.rawResponse);
87
87
  case 500:
88
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
88
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
89
+ unrecognizedObjectKeys: "passthrough",
90
+ allowUnrecognizedUnionMembers: true,
91
+ allowUnrecognizedEnumValues: true,
92
+ skipValidation: true,
93
+ breadcrumbsPrefix: ["response"],
94
+ }), _response.rawResponse);
89
95
  case 504:
90
96
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
91
97
  unrecognizedObjectKeys: "passthrough",
@@ -188,7 +194,13 @@ export class Transcripts {
188
194
  breadcrumbsPrefix: ["response"],
189
195
  }), _response.rawResponse);
190
196
  case 500:
191
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
197
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
198
+ unrecognizedObjectKeys: "passthrough",
199
+ allowUnrecognizedUnionMembers: true,
200
+ allowUnrecognizedEnumValues: true,
201
+ skipValidation: true,
202
+ breadcrumbsPrefix: ["response"],
203
+ }), _response.rawResponse);
192
204
  case 504:
193
205
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
194
206
  unrecognizedObjectKeys: "passthrough",
@@ -282,7 +294,13 @@ export class Transcripts {
282
294
  breadcrumbsPrefix: ["response"],
283
295
  }), _response.rawResponse);
284
296
  case 500:
285
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
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",
@@ -367,7 +385,13 @@ export class Transcripts {
367
385
  breadcrumbsPrefix: ["response"],
368
386
  }), _response.rawResponse);
369
387
  case 500:
370
- throw new Corti.InternalServerError(_response.error.body, _response.rawResponse);
388
+ throw new Corti.InternalServerError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
389
+ unrecognizedObjectKeys: "passthrough",
390
+ allowUnrecognizedUnionMembers: true,
391
+ allowUnrecognizedEnumValues: true,
392
+ skipValidation: true,
393
+ breadcrumbsPrefix: ["response"],
394
+ }), _response.rawResponse);
371
395
  case 504:
372
396
  throw new Corti.GatewayTimeoutError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
373
397
  unrecognizedObjectKeys: "passthrough",
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface StreamFlushMessage {
5
+ type: "flush";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface StreamFlushedMessage {
5
+ type: "flushed";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TranscribeFlushMessage {
5
+ type: "flush";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface TranscribeFlushedMessage {
5
+ type: "flushed";
6
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -71,6 +71,7 @@ export * from "./StreamConfigMode.mjs";
71
71
  export * from "./StreamConfigStatusMessageType.mjs";
72
72
  export * from "./StreamConfigStatusMessage.mjs";
73
73
  export * from "./StreamEndedMessage.mjs";
74
+ export * from "./StreamFlushedMessage.mjs";
74
75
  export * from "./StreamUsageMessage.mjs";
75
76
  export * from "./StreamErrorMessage.mjs";
76
77
  export * from "./StreamErrorDetail.mjs";
@@ -83,6 +84,7 @@ export * from "./StreamTranscriptTime.mjs";
83
84
  export * from "./StreamFactsMessage.mjs";
84
85
  export * from "./StreamFact.mjs";
85
86
  export * from "./StreamEndMessage.mjs";
87
+ export * from "./StreamFlushMessage.mjs";
86
88
  export * from "./StreamSupportedLanguage.mjs";
87
89
  export * from "./TranscribeSupportedLanguage.mjs";
88
90
  export * from "./TranscribeConfig.mjs";
@@ -92,8 +94,10 @@ export * from "./TranscribeCommandVariable.mjs";
92
94
  export * from "./TranscribeConfigStatusMessageType.mjs";
93
95
  export * from "./TranscribeConfigStatusMessage.mjs";
94
96
  export * from "./TranscribeEndMessage.mjs";
97
+ export * from "./TranscribeFlushMessage.mjs";
95
98
  export * from "./TranscribeUsageMessage.mjs";
96
99
  export * from "./TranscribeEndedMessage.mjs";
100
+ export * from "./TranscribeFlushedMessage.mjs";
97
101
  export * from "./TranscribeErrorMessageError.mjs";
98
102
  export * from "./TranscribeErrorMessage.mjs";
99
103
  export * from "./TranscribeTranscriptData.mjs";
@@ -71,6 +71,7 @@ export * from "./StreamConfigMode.mjs";
71
71
  export * from "./StreamConfigStatusMessageType.mjs";
72
72
  export * from "./StreamConfigStatusMessage.mjs";
73
73
  export * from "./StreamEndedMessage.mjs";
74
+ export * from "./StreamFlushedMessage.mjs";
74
75
  export * from "./StreamUsageMessage.mjs";
75
76
  export * from "./StreamErrorMessage.mjs";
76
77
  export * from "./StreamErrorDetail.mjs";
@@ -83,6 +84,7 @@ export * from "./StreamTranscriptTime.mjs";
83
84
  export * from "./StreamFactsMessage.mjs";
84
85
  export * from "./StreamFact.mjs";
85
86
  export * from "./StreamEndMessage.mjs";
87
+ export * from "./StreamFlushMessage.mjs";
86
88
  export * from "./StreamSupportedLanguage.mjs";
87
89
  export * from "./TranscribeSupportedLanguage.mjs";
88
90
  export * from "./TranscribeConfig.mjs";
@@ -92,8 +94,10 @@ export * from "./TranscribeCommandVariable.mjs";
92
94
  export * from "./TranscribeConfigStatusMessageType.mjs";
93
95
  export * from "./TranscribeConfigStatusMessage.mjs";
94
96
  export * from "./TranscribeEndMessage.mjs";
97
+ export * from "./TranscribeFlushMessage.mjs";
95
98
  export * from "./TranscribeUsageMessage.mjs";
96
99
  export * from "./TranscribeEndedMessage.mjs";
100
+ export * from "./TranscribeFlushedMessage.mjs";
97
101
  export * from "./TranscribeErrorMessageError.mjs";
98
102
  export * from "./TranscribeErrorMessage.mjs";
99
103
  export * from "./TranscribeTranscriptData.mjs";
@@ -60,7 +60,7 @@ interface AuthorizationRefreshServer {
60
60
  interface Options {
61
61
  skipRedirect?: boolean;
62
62
  }
63
- type AuthOptions = Omit<FernAuth.Options, 'environment'> & {
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, }: AuthorizationCodeClient, options?: Options): Promise<string>;
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, }: AuthorizationCodeClient, options?: Options): Promise<string>;
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
  */
@@ -42,7 +42,7 @@ export class Auth extends FernAuth {
42
42
  * Patch: Generate PKCE authorization URL with automatic code verifier generation
43
43
  */
44
44
  authorizePkceUrl(_a, options_1) {
45
- return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri, }, options) {
45
+ return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri }, options) {
46
46
  const codeVerifier = generateCodeVerifier();
47
47
  setLocalStorageItem(CODE_VERIFIER_KEY, codeVerifier);
48
48
  const codeChallenge = yield generateCodeChallenge(codeVerifier);
@@ -69,20 +69,20 @@ export class Auth extends FernAuth {
69
69
  * Patch: added method to get Authorization URL for Authorization code flow and PKCE flow
70
70
  */
71
71
  authorizeURL(_a, options_1) {
72
- return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri, codeChallenge, }, options) {
72
+ return __awaiter(this, arguments, void 0, function* ({ clientId, redirectUri, codeChallenge }, options) {
73
73
  var _b;
74
74
  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"));
75
- authUrl.searchParams.set('response_type', 'code');
76
- authUrl.searchParams.set('scope', 'openid profile');
75
+ authUrl.searchParams.set("response_type", "code");
76
+ authUrl.searchParams.set("scope", "openid profile");
77
77
  if (clientId !== undefined) {
78
- authUrl.searchParams.set('client_id', clientId);
78
+ authUrl.searchParams.set("client_id", clientId);
79
79
  }
80
80
  if (redirectUri !== undefined) {
81
- authUrl.searchParams.set('redirect_uri', redirectUri);
81
+ authUrl.searchParams.set("redirect_uri", redirectUri);
82
82
  }
83
83
  if (codeChallenge !== undefined) {
84
- authUrl.searchParams.set('code_challenge', codeChallenge);
85
- authUrl.searchParams.set('code_challenge_method', 'S256');
84
+ authUrl.searchParams.set("code_challenge", codeChallenge);
85
+ authUrl.searchParams.set("code_challenge_method", "S256");
86
86
  }
87
87
  const authUrlString = authUrl.toString();
88
88
  if (typeof window !== "undefined" && !(options === null || options === void 0 ? void 0 : options.skipRedirect)) {
@@ -106,8 +106,8 @@ export class Auth extends FernAuth {
106
106
  if (!codeVerifier) {
107
107
  throw new ParseError([
108
108
  {
109
- path: ['codeVerifier'],
110
- message: 'Code verifier was not provided and not found in localStorage.',
109
+ path: ["codeVerifier"],
110
+ message: "Code verifier was not provided and not found in localStorage.",
111
111
  },
112
112
  ]);
113
113
  }
@@ -72,16 +72,17 @@ export class CortiClient {
72
72
  /**
73
73
  * Patch: if `clientId` is provided, use OAuthTokenProvider, otherwise use BearerProvider
74
74
  */
75
- this._oauthTokenProvider = "clientId" in _options.auth ?
76
- new core.OAuthTokenProvider({
77
- clientId: _options.auth.clientId,
78
- clientSecret: _options.auth.clientSecret,
79
- /**
80
- * Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
81
- */
82
- authClient: new Auth(this._options),
83
- }) :
84
- new RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
75
+ this._oauthTokenProvider =
76
+ "clientId" in _options.auth
77
+ ? new core.OAuthTokenProvider({
78
+ clientId: _options.auth.clientId,
79
+ clientSecret: _options.auth.clientSecret,
80
+ /**
81
+ * Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
82
+ */
83
+ authClient: new Auth(this._options),
84
+ })
85
+ : new RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
85
86
  }
86
87
  get interactions() {
87
88
  var _a;
@@ -14,7 +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({ configuration, ...args }: Omit<FernStream.ConnectArgs, 'token' | 'tenantName'> & {
17
+ connect({ configuration, ...args }: Omit<FernStream.ConnectArgs, "token" | "tenantName"> & {
18
18
  configuration?: api.StreamConfig;
19
19
  }): Promise<StreamSocket>;
20
20
  }