@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
@@ -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 = "clientId" in _options.auth ?
112
- new core.OAuthTokenProvider({
113
- clientId: _options.auth.clientId,
114
- clientSecret: _options.auth.clientSecret,
115
- /**
116
- * Patch: provide whole `options` object to the Auth client, since it depends on both tenantName and environment
117
- */
118
- authClient: new CortiAuth_js_1.Auth(this._options),
119
- }) :
120
- new RefreshBearerProvider_js_1.RefreshBearerProvider(Object.assign(Object.assign({}, _options.auth), { initialTokenResponse }));
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;
@@ -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
  }
@@ -76,18 +76,18 @@ class Stream extends Client_js_1.Stream {
76
76
  });
77
77
  return __awaiter(this, void 0, void 0, function* () {
78
78
  var { configuration } = _a, args = __rest(_a, ["configuration"]);
79
- const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || '', tenantName: yield core.Supplier.get(this._options.tenantName) }));
79
+ const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield core.Supplier.get(this._options.tenantName) }));
80
80
  const ws = new CustomStreamSocket_js_1.StreamSocket({ socket: fernWs.socket });
81
81
  if (!configuration) {
82
82
  return ws;
83
83
  }
84
- ws.socket.addEventListener('open', () => {
84
+ ws.socket.addEventListener("open", () => {
85
85
  ws.sendConfiguration({
86
- type: 'config',
86
+ type: "config",
87
87
  configuration,
88
88
  });
89
89
  });
90
- ws.socket.addEventListener('message', (event) => {
90
+ ws.socket.addEventListener("message", (event) => {
91
91
  const data = (0, json_js_1.fromJson)(event.data);
92
92
  const parsedResponse = serializers.StreamSocketResponse.parse(data, {
93
93
  unrecognizedObjectKeys: "passthrough",
@@ -96,29 +96,30 @@ class Stream extends Client_js_1.Stream {
96
96
  skipValidation: true,
97
97
  omitUndefined: true,
98
98
  });
99
- if (parsedResponse.ok && parsedResponse.value.type === 'CONFIG_ACCEPTED') {
99
+ if (parsedResponse.ok && parsedResponse.value.type === "CONFIG_ACCEPTED") {
100
100
  return;
101
101
  }
102
- if (parsedResponse.ok && (parsedResponse.value.type === 'CONFIG_DENIED'
103
- || parsedResponse.value.type === 'CONFIG_MISSING'
104
- || parsedResponse.value.type === 'CONFIG_TIMEOUT'
105
- || parsedResponse.value.type === 'CONFIG_NOT_PROVIDED')) {
102
+ if (parsedResponse.ok &&
103
+ (parsedResponse.value.type === "CONFIG_DENIED" ||
104
+ parsedResponse.value.type === "CONFIG_MISSING" ||
105
+ parsedResponse.value.type === "CONFIG_TIMEOUT" ||
106
+ parsedResponse.value.type === "CONFIG_NOT_PROVIDED")) {
106
107
  ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
107
108
  name: parsedResponse.value.type,
108
109
  message: JSON.stringify(parsedResponse.value),
109
- }, ''));
110
+ }, ""));
110
111
  ws.close();
111
112
  return;
112
113
  }
113
- if (parsedResponse.ok && parsedResponse.value.type === 'error') {
114
+ if (parsedResponse.ok && parsedResponse.value.type === "error") {
114
115
  ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
115
- name: 'error',
116
+ name: "error",
116
117
  message: JSON.stringify(parsedResponse.value),
117
- }, ''));
118
+ }, ""));
118
119
  ws.close();
119
120
  return;
120
121
  }
121
- if (parsedResponse.ok && parsedResponse.value.type === 'ENDED') {
122
+ if (parsedResponse.ok && parsedResponse.value.type === "ENDED") {
122
123
  ws.close();
123
124
  return;
124
125
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Patch: file patches disability of auto-generating binary data methods for sending data to the socket
3
3
  */
4
- import { StreamSocket as FernStreamSocket } from '../api/resources/stream/client/Socket.js';
4
+ import { StreamSocket as FernStreamSocket } from "../api/resources/stream/client/Socket.js";
5
5
  export declare class StreamSocket extends FernStreamSocket {
6
6
  sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
7
7
  /**
@@ -41,7 +41,7 @@ const Socket_js_1 = require("../api/resources/stream/client/Socket.js");
41
41
  const core = __importStar(require("../core/index.js"));
42
42
  class StreamSocket extends Socket_js_1.StreamSocket {
43
43
  sendAudio(message) {
44
- if (typeof message === 'string') {
44
+ if (typeof message === "string") {
45
45
  return super.sendAudio(message);
46
46
  }
47
47
  this.__assertSocketIsOpen();
@@ -14,7 +14,7 @@ export declare class Transcribe extends FernTranscribe {
14
14
  /**
15
15
  * Patch: use custom connect method to support passing _options parameters
16
16
  */
17
- connect({ configuration, ...args }?: Omit<FernTranscribe.ConnectArgs, 'token' | 'tenantName'> & {
17
+ connect({ configuration, ...args }?: Omit<FernTranscribe.ConnectArgs, "token" | "tenantName"> & {
18
18
  configuration?: api.TranscribeConfig;
19
19
  }): Promise<TranscribeSocket>;
20
20
  }
@@ -76,18 +76,18 @@ class Transcribe extends Client_js_1.Transcribe {
76
76
  });
77
77
  return __awaiter(this, arguments, void 0, function* (_a = {}) {
78
78
  var { configuration } = _a, args = __rest(_a, ["configuration"]);
79
- const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || '', tenantName: yield core.Supplier.get(this._options.tenantName) }));
79
+ const fernWs = yield _super.connect.call(this, Object.assign(Object.assign({}, args), { token: (yield this._getAuthorizationHeader()) || "", tenantName: yield core.Supplier.get(this._options.tenantName) }));
80
80
  const ws = new CustomTranscribeSocket_js_1.TranscribeSocket({ socket: fernWs.socket });
81
81
  if (!configuration) {
82
82
  return ws;
83
83
  }
84
- ws.socket.addEventListener('open', () => {
84
+ ws.socket.addEventListener("open", () => {
85
85
  ws.sendConfiguration({
86
- type: 'config',
86
+ type: "config",
87
87
  configuration,
88
88
  });
89
89
  });
90
- ws.socket.addEventListener('message', (event) => {
90
+ ws.socket.addEventListener("message", (event) => {
91
91
  const data = (0, json_js_1.fromJson)(event.data);
92
92
  const parsedResponse = serializers.TranscribeSocketResponse.parse(data, {
93
93
  unrecognizedObjectKeys: "passthrough",
@@ -96,27 +96,27 @@ class Transcribe extends Client_js_1.Transcribe {
96
96
  skipValidation: true,
97
97
  omitUndefined: true,
98
98
  });
99
- if (parsedResponse.ok && parsedResponse.value.type === 'CONFIG_ACCEPTED') {
99
+ if (parsedResponse.ok && parsedResponse.value.type === "CONFIG_ACCEPTED") {
100
100
  return;
101
101
  }
102
- if (parsedResponse.ok && (parsedResponse.value.type === 'CONFIG_DENIED'
103
- || parsedResponse.value.type === 'CONFIG_TIMEOUT')) {
102
+ if (parsedResponse.ok &&
103
+ (parsedResponse.value.type === "CONFIG_DENIED" || parsedResponse.value.type === "CONFIG_TIMEOUT")) {
104
104
  ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
105
105
  name: parsedResponse.value.type,
106
106
  message: JSON.stringify(parsedResponse.value),
107
- }, ''));
107
+ }, ""));
108
108
  ws.close();
109
109
  return;
110
110
  }
111
- if (parsedResponse.ok && parsedResponse.value.type === 'error') {
111
+ if (parsedResponse.ok && parsedResponse.value.type === "error") {
112
112
  ws.socket.dispatchEvent(new events_js_1.ErrorEvent({
113
- name: 'error',
113
+ name: "error",
114
114
  message: JSON.stringify(parsedResponse.value),
115
- }, ''));
115
+ }, ""));
116
116
  ws.close();
117
117
  return;
118
118
  }
119
- if (parsedResponse.ok && parsedResponse.value.type === 'ended') {
119
+ if (parsedResponse.ok && parsedResponse.value.type === "ended") {
120
120
  ws.close();
121
121
  return;
122
122
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Patch: file patches disability of auto-generating binary data methods for sending data to the socket
3
3
  */
4
- import { TranscribeSocket as FernTranscribeSocket } from '../api/resources/transcribe/client/Socket.js';
4
+ import { TranscribeSocket as FernTranscribeSocket } from "../api/resources/transcribe/client/Socket.js";
5
5
  export declare class TranscribeSocket extends FernTranscribeSocket {
6
6
  sendAudio(message: ArrayBufferLike | Blob | ArrayBufferView | string): void;
7
7
  /**
@@ -41,7 +41,7 @@ const Socket_js_1 = require("../api/resources/transcribe/client/Socket.js");
41
41
  const core = __importStar(require("../core/index.js"));
42
42
  class TranscribeSocket extends Socket_js_1.TranscribeSocket {
43
43
  sendAudio(message) {
44
- if (typeof message === 'string') {
44
+ if (typeof message === "string") {
45
45
  return super.sendAudio(message);
46
46
  }
47
47
  this.__assertSocketIsOpen();
@@ -7,7 +7,7 @@ export type ExpectedTokenResponse = Omit<api.GetTokenResponse, "tokenType" | "ex
7
7
  expiresIn?: number;
8
8
  };
9
9
  type RefreshAccessTokenFunction = (refreshToken?: string) => Promise<ExpectedTokenResponse> | ExpectedTokenResponse;
10
- export type BearerOptions = Partial<Omit<api.GetTokenResponse, 'accessToken'>> & ({
10
+ export type BearerOptions = Partial<Omit<api.GetTokenResponse, "accessToken">> & ({
11
11
  refreshAccessToken?: RefreshAccessTokenFunction;
12
12
  accessToken: string;
13
13
  } | {
@@ -24,21 +24,21 @@ exports.decodeToken = decodeToken;
24
24
  */
25
25
  function decodeToken(token) {
26
26
  // Validate the token structure (should contain at least header and payload parts)
27
- const parts = token ? token.split('.') : '';
27
+ const parts = token ? token.split(".") : "";
28
28
  if (parts.length < 2) {
29
29
  return null;
30
30
  }
31
31
  // Retrieve the payload (second part) of the JWT token
32
32
  const base64Url = parts[1];
33
33
  // Replace URL-safe characters to match standard base64 encoding
34
- const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
34
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
35
35
  // Decode the base64 string into a JSON string
36
36
  let jsonPayload;
37
37
  try {
38
38
  jsonPayload = decodeURIComponent(atob(base64)
39
- .split('')
40
- .map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
41
- .join(''));
39
+ .split("")
40
+ .map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2))
41
+ .join(""));
42
42
  }
43
43
  catch (error) {
44
44
  return null;
@@ -63,9 +63,7 @@ function decodeToken(token) {
63
63
  const match = issuerUrl.match(regex);
64
64
  // If the issuer URL matches the expected pattern, return the extracted values along with the token
65
65
  if (match) {
66
- const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === 'number'
67
- ? tokenDetails.exp
68
- : undefined;
66
+ const expiresAt = tokenDetails.exp && typeof tokenDetails.exp === "number" ? tokenDetails.exp : undefined;
69
67
  return {
70
68
  environment: match[2],
71
69
  tenantName: match[3],
@@ -5,7 +5,9 @@ const CortiSDKError_js_1 = require("../CortiSDKError.js");
5
5
  exports.LOCAL_STORAGE_ERROR_CODE = "local_storage_error";
6
6
  const requireLocalStorage = () => {
7
7
  if (typeof window === "undefined" || !window.localStorage) {
8
- throw new CortiSDKError_js_1.CortiSDKError("LocalStorage operation failed: storage is not available in this environment.", { code: CortiSDKError_js_1.CortiSDKErrorCodes.LOCAL_STORAGE_ERROR });
8
+ throw new CortiSDKError_js_1.CortiSDKError("LocalStorage operation failed: storage is not available in this environment.", {
9
+ code: CortiSDKError_js_1.CortiSDKErrorCodes.LOCAL_STORAGE_ERROR,
10
+ });
9
11
  }
10
12
  return window.localStorage;
11
13
  };
@@ -12,10 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.generateCodeChallenge = exports.generateCodeVerifier = void 0;
13
13
  const base64URLEncode = (buffer) => {
14
14
  const base64 = btoa(String.fromCharCode(...buffer));
15
- return base64
16
- .replace(/\+/g, '-')
17
- .replace(/\//g, '_')
18
- .replace(/=/g, '');
15
+ return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
19
16
  };
20
17
  const generateCodeVerifier = () => {
21
18
  const array = new Uint8Array(32);
@@ -26,7 +23,7 @@ exports.generateCodeVerifier = generateCodeVerifier;
26
23
  const generateCodeChallenge = (verifier) => __awaiter(void 0, void 0, void 0, function* () {
27
24
  const encoder = new TextEncoder();
28
25
  const data = encoder.encode(verifier);
29
- const hash = yield crypto.subtle.digest('SHA-256', data);
26
+ const hash = yield crypto.subtle.digest("SHA-256", data);
30
27
  return base64URLEncode(new Uint8Array(hash));
31
28
  });
32
29
  exports.generateCodeChallenge = generateCodeChallenge;
@@ -100,8 +100,7 @@ function resolveClientOptions(options) {
100
100
  };
101
101
  }))();
102
102
  return {
103
- tenantName: options.tenantName ||
104
- tokenResponsePromise.then(({ tenantName }) => tenantName),
103
+ tenantName: options.tenantName || tokenResponsePromise.then(({ tenantName }) => tenantName),
105
104
  environment: options.environment ||
106
105
  tokenResponsePromise.then(({ environment }) => core.Supplier.get((0, getEnvironmentFromString_js_1.getEnvironment)(environment))),
107
106
  initialTokenResponse: tokenResponsePromise.then((result) => result.tokenResponse),
@@ -7,10 +7,11 @@ import * as core from "../../../../../core/index.js";
7
7
  import { StreamConfigStatusMessage } from "../../../../types/StreamConfigStatusMessage.js";
8
8
  import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.js";
9
9
  import { StreamFactsMessage } from "../../../../types/StreamFactsMessage.js";
10
+ import { StreamFlushedMessage } from "../../../../types/StreamFlushedMessage.js";
10
11
  import { StreamEndedMessage } from "../../../../types/StreamEndedMessage.js";
11
12
  import { StreamUsageMessage } from "../../../../types/StreamUsageMessage.js";
12
13
  import { StreamErrorMessage } from "../../../../types/StreamErrorMessage.js";
13
- export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamConfigStatusMessage | Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage>;
14
+ export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamConfigStatusMessage | Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage>;
14
15
  export declare namespace StreamSocketResponse {
15
- type Raw = StreamConfigStatusMessage.Raw | StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw;
16
+ type Raw = StreamConfigStatusMessage.Raw | StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamFlushedMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw;
16
17
  }
@@ -41,6 +41,7 @@ const core = __importStar(require("../../../../../core/index.js"));
41
41
  const StreamConfigStatusMessage_js_1 = require("../../../../types/StreamConfigStatusMessage.js");
42
42
  const StreamTranscriptMessage_js_1 = require("../../../../types/StreamTranscriptMessage.js");
43
43
  const StreamFactsMessage_js_1 = require("../../../../types/StreamFactsMessage.js");
44
+ const StreamFlushedMessage_js_1 = require("../../../../types/StreamFlushedMessage.js");
44
45
  const StreamEndedMessage_js_1 = require("../../../../types/StreamEndedMessage.js");
45
46
  const StreamUsageMessage_js_1 = require("../../../../types/StreamUsageMessage.js");
46
47
  const StreamErrorMessage_js_1 = require("../../../../types/StreamErrorMessage.js");
@@ -48,6 +49,7 @@ exports.StreamSocketResponse = core.serialization.undiscriminatedUnion([
48
49
  StreamConfigStatusMessage_js_1.StreamConfigStatusMessage,
49
50
  StreamTranscriptMessage_js_1.StreamTranscriptMessage,
50
51
  StreamFactsMessage_js_1.StreamFactsMessage,
52
+ StreamFlushedMessage_js_1.StreamFlushedMessage,
51
53
  StreamEndedMessage_js_1.StreamEndedMessage,
52
54
  StreamUsageMessage_js_1.StreamUsageMessage,
53
55
  StreamErrorMessage_js_1.StreamErrorMessage,
@@ -6,11 +6,12 @@ import * as Corti from "../../../../../api/index.js";
6
6
  import * as core from "../../../../../core/index.js";
7
7
  import { TranscribeConfigStatusMessage } from "../../../../types/TranscribeConfigStatusMessage.js";
8
8
  import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.js";
9
+ import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMessage.js";
9
10
  import { TranscribeEndedMessage } from "../../../../types/TranscribeEndedMessage.js";
10
11
  import { TranscribeErrorMessage } from "../../../../types/TranscribeErrorMessage.js";
11
12
  import { TranscribeTranscriptMessage } from "../../../../types/TranscribeTranscriptMessage.js";
12
13
  import { TranscribeCommandMessage } from "../../../../types/TranscribeCommandMessage.js";
13
- export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage>;
14
+ export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeConfigStatusMessage | Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage>;
14
15
  export declare namespace TranscribeSocketResponse {
15
- type Raw = TranscribeConfigStatusMessage.Raw | TranscribeUsageMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw;
16
+ type Raw = TranscribeConfigStatusMessage.Raw | TranscribeUsageMessage.Raw | TranscribeFlushedMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw;
16
17
  }
@@ -40,6 +40,7 @@ exports.TranscribeSocketResponse = void 0;
40
40
  const core = __importStar(require("../../../../../core/index.js"));
41
41
  const TranscribeConfigStatusMessage_js_1 = require("../../../../types/TranscribeConfigStatusMessage.js");
42
42
  const TranscribeUsageMessage_js_1 = require("../../../../types/TranscribeUsageMessage.js");
43
+ const TranscribeFlushedMessage_js_1 = require("../../../../types/TranscribeFlushedMessage.js");
43
44
  const TranscribeEndedMessage_js_1 = require("../../../../types/TranscribeEndedMessage.js");
44
45
  const TranscribeErrorMessage_js_1 = require("../../../../types/TranscribeErrorMessage.js");
45
46
  const TranscribeTranscriptMessage_js_1 = require("../../../../types/TranscribeTranscriptMessage.js");
@@ -47,6 +48,7 @@ const TranscribeCommandMessage_js_1 = require("../../../../types/TranscribeComma
47
48
  exports.TranscribeSocketResponse = core.serialization.undiscriminatedUnion([
48
49
  TranscribeConfigStatusMessage_js_1.TranscribeConfigStatusMessage,
49
50
  TranscribeUsageMessage_js_1.TranscribeUsageMessage,
51
+ TranscribeFlushedMessage_js_1.TranscribeFlushedMessage,
50
52
  TranscribeEndedMessage_js_1.TranscribeEndedMessage,
51
53
  TranscribeErrorMessage_js_1.TranscribeErrorMessage,
52
54
  TranscribeTranscriptMessage_js_1.TranscribeTranscriptMessage,
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.js";
5
+ import * as Corti from "../../api/index.js";
6
+ import * as core from "../../core/index.js";
7
+ export declare const StreamFlushMessage: core.serialization.ObjectSchema<serializers.StreamFlushMessage.Raw, Corti.StreamFlushMessage>;
8
+ export declare namespace StreamFlushMessage {
9
+ interface Raw {
10
+ type: "flush";
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.StreamFlushMessage = void 0;
40
+ const core = __importStar(require("../../core/index.js"));
41
+ exports.StreamFlushMessage = core.serialization.object({
42
+ type: core.serialization.stringLiteral("flush"),
43
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.js";
5
+ import * as Corti from "../../api/index.js";
6
+ import * as core from "../../core/index.js";
7
+ export declare const StreamFlushedMessage: core.serialization.ObjectSchema<serializers.StreamFlushedMessage.Raw, Corti.StreamFlushedMessage>;
8
+ export declare namespace StreamFlushedMessage {
9
+ interface Raw {
10
+ type: "flushed";
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.StreamFlushedMessage = void 0;
40
+ const core = __importStar(require("../../core/index.js"));
41
+ exports.StreamFlushedMessage = core.serialization.object({
42
+ type: core.serialization.stringLiteral("flushed"),
43
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.js";
5
+ import * as Corti from "../../api/index.js";
6
+ import * as core from "../../core/index.js";
7
+ export declare const TranscribeFlushMessage: core.serialization.ObjectSchema<serializers.TranscribeFlushMessage.Raw, Corti.TranscribeFlushMessage>;
8
+ export declare namespace TranscribeFlushMessage {
9
+ interface Raw {
10
+ type: "flush";
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.TranscribeFlushMessage = void 0;
40
+ const core = __importStar(require("../../core/index.js"));
41
+ exports.TranscribeFlushMessage = core.serialization.object({
42
+ type: core.serialization.stringLiteral("flush"),
43
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as serializers from "../index.js";
5
+ import * as Corti from "../../api/index.js";
6
+ import * as core from "../../core/index.js";
7
+ export declare const TranscribeFlushedMessage: core.serialization.ObjectSchema<serializers.TranscribeFlushedMessage.Raw, Corti.TranscribeFlushedMessage>;
8
+ export declare namespace TranscribeFlushedMessage {
9
+ interface Raw {
10
+ type: "flushed";
11
+ }
12
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.TranscribeFlushedMessage = void 0;
40
+ const core = __importStar(require("../../core/index.js"));
41
+ exports.TranscribeFlushedMessage = core.serialization.object({
42
+ type: core.serialization.stringLiteral("flushed"),
43
+ });