telnyx 6.70.0 → 6.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/client.d.mts +13 -6
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -6
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/ai/ai.d.mts +1 -1
- package/resources/ai/ai.d.mts.map +1 -1
- package/resources/ai/ai.d.ts +1 -1
- package/resources/ai/ai.d.ts.map +1 -1
- package/resources/ai/ai.js +2 -2
- package/resources/ai/ai.js.map +1 -1
- package/resources/ai/ai.mjs +2 -2
- package/resources/ai/ai.mjs.map +1 -1
- package/resources/calls/actions.d.mts +260 -247
- package/resources/calls/actions.d.mts.map +1 -1
- package/resources/calls/actions.d.ts +260 -247
- package/resources/calls/actions.d.ts.map +1 -1
- package/resources/calls/actions.js.map +1 -1
- package/resources/calls/actions.mjs.map +1 -1
- package/resources/calls/calls.d.mts +210 -3
- package/resources/calls/calls.d.mts.map +1 -1
- package/resources/calls/calls.d.ts +210 -3
- package/resources/calls/calls.d.ts.map +1 -1
- package/resources/calls/calls.js.map +1 -1
- package/resources/calls/calls.mjs.map +1 -1
- package/resources/calls/index.d.mts +2 -2
- package/resources/calls/index.d.mts.map +1 -1
- package/resources/calls/index.d.ts +2 -2
- package/resources/calls/index.d.ts.map +1 -1
- package/resources/calls/index.js.map +1 -1
- package/resources/calls/index.mjs.map +1 -1
- package/resources/conferences/actions.d.mts +1 -9
- package/resources/conferences/actions.d.mts.map +1 -1
- package/resources/conferences/actions.d.ts +1 -9
- package/resources/conferences/actions.d.ts.map +1 -1
- package/resources/index.d.mts +4 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.mts +6 -0
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +6 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/speech-to-text/index.d.mts +3 -3
- package/resources/speech-to-text/index.d.mts.map +1 -1
- package/resources/speech-to-text/index.d.ts +3 -3
- package/resources/speech-to-text/index.d.ts.map +1 -1
- package/resources/speech-to-text/index.js +1 -5
- package/resources/speech-to-text/index.js.map +1 -1
- package/resources/speech-to-text/index.mjs +0 -2
- package/resources/speech-to-text/index.mjs.map +1 -1
- package/resources/speech-to-text/internal-base.d.mts +42 -11
- package/resources/speech-to-text/internal-base.d.mts.map +1 -1
- package/resources/speech-to-text/internal-base.d.ts +42 -11
- package/resources/speech-to-text/internal-base.d.ts.map +1 -1
- package/resources/speech-to-text/internal-base.js +5 -9
- package/resources/speech-to-text/internal-base.js.map +1 -1
- package/resources/speech-to-text/internal-base.mjs +5 -9
- package/resources/speech-to-text/internal-base.mjs.map +1 -1
- package/resources/speech-to-text/speech-to-text.d.mts +79 -100
- package/resources/speech-to-text/speech-to-text.d.mts.map +1 -1
- package/resources/speech-to-text/speech-to-text.d.ts +79 -100
- package/resources/speech-to-text/speech-to-text.d.ts.map +1 -1
- package/resources/speech-to-text/speech-to-text.js +16 -19
- package/resources/speech-to-text/speech-to-text.js.map +1 -1
- package/resources/speech-to-text/speech-to-text.mjs +16 -19
- package/resources/speech-to-text/speech-to-text.mjs.map +1 -1
- package/resources/speech-to-text/ws-base.d.mts +106 -0
- package/resources/speech-to-text/ws-base.d.mts.map +1 -0
- package/resources/speech-to-text/ws-base.d.ts +106 -0
- package/resources/speech-to-text/ws-base.d.ts.map +1 -0
- package/resources/speech-to-text/ws-base.js +476 -0
- package/resources/speech-to-text/ws-base.js.map +1 -0
- package/resources/speech-to-text/ws-base.mjs +472 -0
- package/resources/speech-to-text/ws-base.mjs.map +1 -0
- package/resources/speech-to-text/ws.d.mts +9 -28
- package/resources/speech-to-text/ws.d.mts.map +1 -1
- package/resources/speech-to-text/ws.d.ts +9 -28
- package/resources/speech-to-text/ws.d.ts.map +1 -1
- package/resources/speech-to-text/ws.js +17 -97
- package/resources/speech-to-text/ws.js.map +1 -1
- package/resources/speech-to-text/ws.mjs +17 -97
- package/resources/speech-to-text/ws.mjs.map +1 -1
- package/resources/speech-to-text.d.mts +2 -0
- package/resources/speech-to-text.d.mts.map +1 -0
- package/resources/speech-to-text.d.ts +2 -0
- package/resources/speech-to-text.d.ts.map +1 -0
- package/resources/speech-to-text.js +6 -0
- package/resources/speech-to-text.js.map +1 -0
- package/resources/speech-to-text.mjs +3 -0
- package/resources/speech-to-text.mjs.map +1 -0
- package/resources/texml/accounts/calls/calls.d.mts +31 -465
- package/resources/texml/accounts/calls/calls.d.mts.map +1 -1
- package/resources/texml/accounts/calls/calls.d.ts +31 -465
- package/resources/texml/accounts/calls/calls.d.ts.map +1 -1
- package/resources/texml/accounts/calls/calls.js +7 -1
- package/resources/texml/accounts/calls/calls.js.map +1 -1
- package/resources/texml/accounts/calls/calls.mjs +7 -1
- package/resources/texml/accounts/calls/calls.mjs.map +1 -1
- package/resources/text-to-speech/index.d.mts +1 -1
- package/resources/text-to-speech/index.d.mts.map +1 -1
- package/resources/text-to-speech/index.d.ts +1 -1
- package/resources/text-to-speech/index.d.ts.map +1 -1
- package/resources/text-to-speech/index.js.map +1 -1
- package/resources/text-to-speech/index.mjs.map +1 -1
- package/resources/text-to-speech/text-to-speech.d.mts +79 -13
- package/resources/text-to-speech/text-to-speech.d.mts.map +1 -1
- package/resources/text-to-speech/text-to-speech.d.ts +79 -13
- package/resources/text-to-speech/text-to-speech.d.ts.map +1 -1
- package/resources/text-to-speech/text-to-speech.js +33 -1
- package/resources/text-to-speech/text-to-speech.js.map +1 -1
- package/resources/text-to-speech/text-to-speech.mjs +33 -1
- package/resources/text-to-speech/text-to-speech.mjs.map +1 -1
- package/resources/voice-sdk-call-reports.d.mts +30 -105
- package/resources/voice-sdk-call-reports.d.mts.map +1 -1
- package/resources/voice-sdk-call-reports.d.ts +30 -105
- package/resources/voice-sdk-call-reports.d.ts.map +1 -1
- package/resources/voice-sdk-call-reports.js.map +1 -1
- package/resources/voice-sdk-call-reports.mjs.map +1 -1
- package/resources/whatsapp/index.d.mts +1 -1
- package/resources/whatsapp/index.d.mts.map +1 -1
- package/resources/whatsapp/index.d.ts +1 -1
- package/resources/whatsapp/index.d.ts.map +1 -1
- package/resources/whatsapp/index.js.map +1 -1
- package/resources/whatsapp/index.mjs.map +1 -1
- package/resources/whatsapp/user-data.d.mts +16 -33
- package/resources/whatsapp/user-data.d.mts.map +1 -1
- package/resources/whatsapp/user-data.d.ts +16 -33
- package/resources/whatsapp/user-data.d.ts.map +1 -1
- package/resources/whatsapp/whatsapp.d.mts +2 -2
- package/resources/whatsapp/whatsapp.d.mts.map +1 -1
- package/resources/whatsapp/whatsapp.d.ts +2 -2
- package/resources/whatsapp/whatsapp.d.ts.map +1 -1
- package/resources/whatsapp/whatsapp.js.map +1 -1
- package/resources/whatsapp/whatsapp.mjs.map +1 -1
- package/src/client.ts +33 -4
- package/src/resources/ai/ai.ts +3 -3
- package/src/resources/calls/actions.ts +331 -320
- package/src/resources/calls/calls.ts +272 -0
- package/src/resources/calls/index.ts +4 -0
- package/src/resources/conferences/actions.ts +1 -10
- package/src/resources/index.ts +13 -2
- package/src/resources/shared.ts +7 -0
- package/src/resources/speech-to-text/index.ts +6 -9
- package/src/resources/speech-to-text/internal-base.ts +49 -22
- package/src/resources/speech-to-text/speech-to-text.ts +102 -128
- package/src/resources/speech-to-text/ws-base.ts +619 -0
- package/src/resources/speech-to-text/ws.ts +26 -111
- package/src/resources/speech-to-text.ts +3 -0
- package/src/resources/texml/accounts/calls/calls.ts +36 -564
- package/src/resources/text-to-speech/index.ts +3 -2
- package/src/resources/text-to-speech/text-to-speech.ts +100 -16
- package/src/resources/voice-sdk-call-reports.ts +33 -116
- package/src/resources/whatsapp/index.ts +1 -0
- package/src/resources/whatsapp/user-data.ts +17 -38
- package/src/resources/whatsapp/whatsapp.ts +2 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { SpeechToTextEmitter, SpeechToTextStreamMessage } from "./internal-base.mjs";
|
|
2
|
+
import { type WebSocketLike } from "../../internal/ws-adapter.mjs";
|
|
3
|
+
import { type RawWebSocketData, type ReconnectingEvent, type ReconnectingOverrides } from "../../internal/ws.mjs";
|
|
4
|
+
import * as SpeechToTextAPI from "./speech-to-text.mjs";
|
|
5
|
+
import { Telnyx } from "../../client.mjs";
|
|
6
|
+
export interface SpeechToTextWSReconnectOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Called before each reconnect attempt. Return an object with
|
|
9
|
+
* `parameters` to override query parameters for the next connection.
|
|
10
|
+
*/
|
|
11
|
+
onReconnecting(event: ReconnectingEvent<Record<string, unknown>>): ReconnectingOverrides<Record<string, unknown>> | void;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum number of reconnection attempts. Default: 5.
|
|
14
|
+
* Set to 0 to disable reconnection entirely.
|
|
15
|
+
*/
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Initial backoff delay in milliseconds. Default: 500.
|
|
19
|
+
*/
|
|
20
|
+
initialDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum backoff delay in milliseconds. Default: 8000.
|
|
23
|
+
*/
|
|
24
|
+
maxDelay?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SpeechToTextWSBaseOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Options for automatic reconnection on recoverable close codes.
|
|
29
|
+
* Automatic reconnection is only enabled when this has a non-null value.
|
|
30
|
+
*/
|
|
31
|
+
reconnect?: SpeechToTextWSReconnectOptions | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum size of the outgoing message queue in bytes.
|
|
34
|
+
* Messages queued while the socket is connecting or reconnecting are held
|
|
35
|
+
* in memory up to this limit. Once the limit is reached, new messages are
|
|
36
|
+
* discarded and an `error` event is emitted.
|
|
37
|
+
* Default: 1 MB
|
|
38
|
+
*/
|
|
39
|
+
maxQueueSize?: number | undefined;
|
|
40
|
+
}
|
|
41
|
+
export declare abstract class SpeechToTextWSBase<TSocket extends WebSocketLike> extends SpeechToTextEmitter {
|
|
42
|
+
url: URL;
|
|
43
|
+
socket: TSocket;
|
|
44
|
+
protected _client: Telnyx;
|
|
45
|
+
protected _parameters: Record<string, unknown> | null | undefined;
|
|
46
|
+
private _reconnectOptions;
|
|
47
|
+
private _sendQueue;
|
|
48
|
+
private _isReconnecting;
|
|
49
|
+
private _intentionallyClosed;
|
|
50
|
+
private _closeCode;
|
|
51
|
+
private _closeReason;
|
|
52
|
+
private _lastCloseCode;
|
|
53
|
+
private _lastCloseReason;
|
|
54
|
+
private _internalEvents;
|
|
55
|
+
constructor(client: Telnyx, parameters?: Record<string, unknown> | undefined, options?: SpeechToTextWSBaseOptions | undefined);
|
|
56
|
+
/** Establishes the initial WebSocket connection. */
|
|
57
|
+
protected _connectInitial(): void;
|
|
58
|
+
/** Creates a platform-specific WebSocket for the given URL and auth headers. */
|
|
59
|
+
protected abstract _createSocket(url: URL, authHeaders: Record<string, string>): TSocket;
|
|
60
|
+
send(event: SpeechToTextAPI.TranscribeClientEvent): void;
|
|
61
|
+
sendRaw(data: RawWebSocketData): void;
|
|
62
|
+
close(props?: {
|
|
63
|
+
code: number;
|
|
64
|
+
reason: string;
|
|
65
|
+
}): void;
|
|
66
|
+
/**
|
|
67
|
+
* Returns an async iterator over WebSocket lifecycle and message events,
|
|
68
|
+
* providing an alternative to the event-based `.on()` API.
|
|
69
|
+
* The iterator will exit if the socket closes but exiting the iterator
|
|
70
|
+
* does not close the socket.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* for await (const event of client.stream()) {
|
|
75
|
+
* switch (event.type) {
|
|
76
|
+
* case 'message':
|
|
77
|
+
* console.log('received:', event.message);
|
|
78
|
+
* break;
|
|
79
|
+
* case 'error':
|
|
80
|
+
* console.error(event.error);
|
|
81
|
+
* break;
|
|
82
|
+
* case 'close':
|
|
83
|
+
* console.log('connection closed');
|
|
84
|
+
* break;
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
stream(): AsyncIterableIterator<SpeechToTextStreamMessage>;
|
|
90
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<SpeechToTextStreamMessage>;
|
|
91
|
+
private _connect;
|
|
92
|
+
private _canReconnect;
|
|
93
|
+
private _reconnect;
|
|
94
|
+
/**
|
|
95
|
+
* Resolves once the socket is open, rejects if it errors or closes first
|
|
96
|
+
*/
|
|
97
|
+
private _awaitOpen;
|
|
98
|
+
private _flushSendQueue;
|
|
99
|
+
/**
|
|
100
|
+
* Emits the public `close` event with unsent messages and the internal
|
|
101
|
+
* `close` event used by the async iterator.
|
|
102
|
+
*/
|
|
103
|
+
private _emitPermanentClose;
|
|
104
|
+
protected _authHeaders(): Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=ws-base.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-base.d.mts","sourceRoot":"","sources":["../../src/resources/speech-to-text/ws-base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAA4B,4BAAwB;AAG3G,OAAO,EAAE,KAAK,aAAa,EAAc,sCAAkC;AAC3E,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE3B,8BAA0B;AAC3B,OAAO,KAAK,eAAe,6BAAyB;AACpD,OAAO,EAAE,MAAM,EAAE,yBAAqB;AAGtC,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,cAAc,CACZ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,gFAAgF;IAChF,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO;IAExF,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,qBAAqB;IAsBjD,OAAO,CAAC,IAAI,EAAE,gBAAgB;IAsB9B,KAAK,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAe9C;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,IAAI,qBAAqB,CAAC,yBAAyB,CAAC;IAI1D,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,yBAAyB,CAAC;IAwJ1E,OAAO,CAAC,QAAQ;IA2DhB,OAAO,CAAC,aAAa;YAQP,UAAU;IA+IxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAU3B,SAAS,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAMjD"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { SpeechToTextEmitter, SpeechToTextStreamMessage } from "./internal-base.js";
|
|
2
|
+
import { type WebSocketLike } from "../../internal/ws-adapter.js";
|
|
3
|
+
import { type RawWebSocketData, type ReconnectingEvent, type ReconnectingOverrides } from "../../internal/ws.js";
|
|
4
|
+
import * as SpeechToTextAPI from "./speech-to-text.js";
|
|
5
|
+
import { Telnyx } from "../../client.js";
|
|
6
|
+
export interface SpeechToTextWSReconnectOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Called before each reconnect attempt. Return an object with
|
|
9
|
+
* `parameters` to override query parameters for the next connection.
|
|
10
|
+
*/
|
|
11
|
+
onReconnecting(event: ReconnectingEvent<Record<string, unknown>>): ReconnectingOverrides<Record<string, unknown>> | void;
|
|
12
|
+
/**
|
|
13
|
+
* Maximum number of reconnection attempts. Default: 5.
|
|
14
|
+
* Set to 0 to disable reconnection entirely.
|
|
15
|
+
*/
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Initial backoff delay in milliseconds. Default: 500.
|
|
19
|
+
*/
|
|
20
|
+
initialDelay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum backoff delay in milliseconds. Default: 8000.
|
|
23
|
+
*/
|
|
24
|
+
maxDelay?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SpeechToTextWSBaseOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Options for automatic reconnection on recoverable close codes.
|
|
29
|
+
* Automatic reconnection is only enabled when this has a non-null value.
|
|
30
|
+
*/
|
|
31
|
+
reconnect?: SpeechToTextWSReconnectOptions | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Maximum size of the outgoing message queue in bytes.
|
|
34
|
+
* Messages queued while the socket is connecting or reconnecting are held
|
|
35
|
+
* in memory up to this limit. Once the limit is reached, new messages are
|
|
36
|
+
* discarded and an `error` event is emitted.
|
|
37
|
+
* Default: 1 MB
|
|
38
|
+
*/
|
|
39
|
+
maxQueueSize?: number | undefined;
|
|
40
|
+
}
|
|
41
|
+
export declare abstract class SpeechToTextWSBase<TSocket extends WebSocketLike> extends SpeechToTextEmitter {
|
|
42
|
+
url: URL;
|
|
43
|
+
socket: TSocket;
|
|
44
|
+
protected _client: Telnyx;
|
|
45
|
+
protected _parameters: Record<string, unknown> | null | undefined;
|
|
46
|
+
private _reconnectOptions;
|
|
47
|
+
private _sendQueue;
|
|
48
|
+
private _isReconnecting;
|
|
49
|
+
private _intentionallyClosed;
|
|
50
|
+
private _closeCode;
|
|
51
|
+
private _closeReason;
|
|
52
|
+
private _lastCloseCode;
|
|
53
|
+
private _lastCloseReason;
|
|
54
|
+
private _internalEvents;
|
|
55
|
+
constructor(client: Telnyx, parameters?: Record<string, unknown> | undefined, options?: SpeechToTextWSBaseOptions | undefined);
|
|
56
|
+
/** Establishes the initial WebSocket connection. */
|
|
57
|
+
protected _connectInitial(): void;
|
|
58
|
+
/** Creates a platform-specific WebSocket for the given URL and auth headers. */
|
|
59
|
+
protected abstract _createSocket(url: URL, authHeaders: Record<string, string>): TSocket;
|
|
60
|
+
send(event: SpeechToTextAPI.TranscribeClientEvent): void;
|
|
61
|
+
sendRaw(data: RawWebSocketData): void;
|
|
62
|
+
close(props?: {
|
|
63
|
+
code: number;
|
|
64
|
+
reason: string;
|
|
65
|
+
}): void;
|
|
66
|
+
/**
|
|
67
|
+
* Returns an async iterator over WebSocket lifecycle and message events,
|
|
68
|
+
* providing an alternative to the event-based `.on()` API.
|
|
69
|
+
* The iterator will exit if the socket closes but exiting the iterator
|
|
70
|
+
* does not close the socket.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* for await (const event of client.stream()) {
|
|
75
|
+
* switch (event.type) {
|
|
76
|
+
* case 'message':
|
|
77
|
+
* console.log('received:', event.message);
|
|
78
|
+
* break;
|
|
79
|
+
* case 'error':
|
|
80
|
+
* console.error(event.error);
|
|
81
|
+
* break;
|
|
82
|
+
* case 'close':
|
|
83
|
+
* console.log('connection closed');
|
|
84
|
+
* break;
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
stream(): AsyncIterableIterator<SpeechToTextStreamMessage>;
|
|
90
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<SpeechToTextStreamMessage>;
|
|
91
|
+
private _connect;
|
|
92
|
+
private _canReconnect;
|
|
93
|
+
private _reconnect;
|
|
94
|
+
/**
|
|
95
|
+
* Resolves once the socket is open, rejects if it errors or closes first
|
|
96
|
+
*/
|
|
97
|
+
private _awaitOpen;
|
|
98
|
+
private _flushSendQueue;
|
|
99
|
+
/**
|
|
100
|
+
* Emits the public `close` event with unsent messages and the internal
|
|
101
|
+
* `close` event used by the async iterator.
|
|
102
|
+
*/
|
|
103
|
+
private _emitPermanentClose;
|
|
104
|
+
protected _authHeaders(): Record<string, string>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=ws-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ws-base.d.ts","sourceRoot":"","sources":["../../src/resources/speech-to-text/ws-base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAA4B,2BAAwB;AAG3G,OAAO,EAAE,KAAK,aAAa,EAAc,qCAAkC;AAC3E,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE3B,6BAA0B;AAC3B,OAAO,KAAK,eAAe,4BAAyB;AACpD,OAAO,EAAE,MAAM,EAAE,wBAAqB;AAGtC,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,cAAc,CACZ,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAChD,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAEzD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,8BAA8B,GAAG,IAAI,GAAG,SAAS,CAAC;IAE9D;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,8BAAsB,kBAAkB,CAAC,OAAO,SAAS,aAAa,CAAE,SAAQ,mBAAmB;IACjG,GAAG,EAAG,GAAG,CAAC;IACV,MAAM,EAAG,OAAO,CAAC;IAEjB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1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