@corti/sdk 0.6.0 → 0.7.0-rc

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 +6 -6
  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 +6 -6
  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
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
  });
@@ -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.6.0",
68
- "User-Agent": "@corti/sdk/0.6.0",
67
+ "X-Fern-SDK-Version": "0.7.0-rc",
68
+ "User-Agent": "@corti/sdk/0.7.0-rc",
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?: unknown, rawResponse?: core.RawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _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",
@@ -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, _response.rawResponse);
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
- .string()
125
- .jsonOrThrow(message, {
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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
- .string()
125
- .jsonOrThrow(message, {
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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, _response.rawResponse);
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",
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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);
@@ -51,16 +51,16 @@ interface AuthorizationRopcServer {
51
51
  }
52
52
  interface AuthorizationRefreshServer {
53
53
  clientId: string;
54
- clientSecret: string;
55
54
  /**
56
- * Patch: added optional refreshToken for ROPC and PKCE flow
55
+ * Patch: added optional clientSecret for ROPC and PKCE flow
57
56
  */
58
- refreshToken?: string;
57
+ clientSecret?: string;
58
+ refreshToken: string;
59
59
  }
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
  */
@@ -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, }, options) {
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, }, options) {
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('response_type', 'code');
112
- authUrl.searchParams.set('scope', 'openid profile');
111
+ authUrl.searchParams.set("response_type", "code");
112
+ authUrl.searchParams.set("scope", "openid profile");
113
113
  if (clientId !== undefined) {
114
- authUrl.searchParams.set('client_id', clientId);
114
+ authUrl.searchParams.set("client_id", clientId);
115
115
  }
116
116
  if (redirectUri !== undefined) {
117
- authUrl.searchParams.set('redirect_uri', redirectUri);
117
+ authUrl.searchParams.set("redirect_uri", redirectUri);
118
118
  }
119
119
  if (codeChallenge !== undefined) {
120
- authUrl.searchParams.set('code_challenge', codeChallenge);
121
- authUrl.searchParams.set('code_challenge_method', 'S256');
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: ['codeVerifier'],
146
- message: 'Code verifier was not provided and not found in localStorage.',
145
+ path: ["codeVerifier"],
146
+ message: "Code verifier was not provided and not found in localStorage.",
147
147
  },
148
148
  ]);
149
149
  }