Skip to content

Commit e361cb4

Browse files
authored
Merge pull request #131 from anam-org/feat/improved-closed-connection-errors
fix: export connection closed enum correctly
2 parents 9fea573 + 1e25440 commit e361cb4

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

src/AnamClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import {
2323
PersonaConfig,
2424
StartSessionOptions,
2525
StartSessionResponse,
26+
ConnectionClosedCode,
2627
} from './types';
2728
import { TalkMessageStream } from './types/TalkMessageStream';
2829
import { Buffer } from 'buffer';
29-
import { ConnectionClosedCode } from './lib/constants';
3030
export default class AnamClient {
3131
private publicEventEmitter: PublicEventEmitter;
3232
private internalEventEmitter: InternalEventEmitter;

src/lib/constants.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ export const DEFAULT_HEADERS = {
66
export const DEFAULT_API_BASE_URL = 'https://api.anam.ai';
77
export const DEFAULT_API_VERSION = '/v1'; // include the leading slash
88

9-
// Connection closed codes
10-
export enum ConnectionClosedCode {
11-
NORMAL = 'CONNECTION_CLOSED_CODE_NORMAL',
12-
MICROPHONE_PERMISSION_DENIED = 'CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED',
13-
SIGNALLING_CLIENT_CONNECTION_FAILURE = 'CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE',
14-
WEBRTC_FAILURE = 'CONNECTION_CLOSED_CODE_WEBRTC_FAILURE',
15-
SERVER_CLOSED_CONNECTION = 'CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION',
16-
}
17-
189
export const CLIENT_METADATA = {
1910
client: 'js-sdk',
2011
version: '0.0.0-automated',

src/modules/SignallingClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { ConnectionClosedCode } from '../lib/constants';
21
import { InternalEventEmitter, PublicEventEmitter } from '.';
32
import {
43
AnamEvent,
54
InternalEvent,
65
SignalMessage,
76
SignalMessageAction,
87
SignallingClientOptions,
8+
ConnectionClosedCode,
99
} from '../types';
1010
import { TalkMessageStreamPayload } from '../types/signalling/TalkMessageStreamPayload';
1111

src/modules/StreamingClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ConnectionClosedCode } from '../lib/constants';
21
import {
32
EngineApiRestClient,
43
InternalEventEmitter,
@@ -13,6 +12,7 @@ import {
1312
SignalMessageAction,
1413
StreamingClientOptions,
1514
WebRtcTextMessageEvent,
15+
ConnectionClosedCode,
1616
} from '../types';
1717
import { TalkMessageStream } from '../types/TalkMessageStream';
1818
import { TalkStreamInterruptedSignalMessage } from '../types/signalling/TalkStreamInterruptedSignalMessage';

src/types/events/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export type { EventCallbacks } from './public/EventCallbacks';
33
export { InternalEvent } from './internal/InternalEvent';
44
export type { InternalEventCallbacks } from './internal/InternalEventCallbacks';
55
export type { EventCallback } from './EventCallback';
6+
export { ConnectionClosedCode } from './public/ConnectionClosedCodes';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export enum ConnectionClosedCode {
2+
NORMAL = 'CONNECTION_CLOSED_CODE_NORMAL',
3+
MICROPHONE_PERMISSION_DENIED = 'CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED',
4+
SIGNALLING_CLIENT_CONNECTION_FAILURE = 'CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE',
5+
WEBRTC_FAILURE = 'CONNECTION_CLOSED_CODE_WEBRTC_FAILURE',
6+
SERVER_CLOSED_CONNECTION = 'CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION',
7+
}

src/types/events/public/EventCallbacks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConnectionClosedCode } from '../../../lib/constants';
1+
import { ConnectionClosedCode } from './ConnectionClosedCodes';
22
import { Message, MessageStreamEvent, AnamEvent } from '../../index';
33

44
export type EventCallbacks = {

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export { MessageRole } from './messageHistory'; // need to export this explicitl
1010
export type * from './events';
1111
export { AnamEvent } from './events'; // need to export this explicitly to avoid enum import issues
1212
export { InternalEvent } from './events'; // need to export this explicitly to avoid enum import issues
13+
export { ConnectionClosedCode } from './events'; // need to export this explicitly to avoid enum import issues

0 commit comments

Comments
 (0)