@deeptrekker/api-channels 0.7.0 → 0.7.2-testingconnectionfix.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.
@@ -1,9 +1,9 @@
1
- import { ConfigProperties, ConnectionSettings, WebRtcOptions } from "@types";
2
- /**
3
- * Establish Full Connection
4
- *
5
- * Sets up the {@link HubConnection} and then initializes the {@link RTCPeerConnection}.
6
- * @param connectionSettings {@link ConnectionSettings}
7
- * @param callbacks {@link WebRtcOptions}
8
- */
9
- export declare const establishFullConnection: (connectionSettings: ConnectionSettings, callbacks: WebRtcOptions, configProperties?: ConfigProperties) => Promise<void>;
1
+ import { ConfigProperties, ConnectionSettings, WebRtcOptions } from "@types";
2
+ /**
3
+ * Establish Full Connection
4
+ *
5
+ * Sets up the {@link HubConnection} and then initializes the {@link RTCPeerConnection}.
6
+ * @param connectionSettings {@link ConnectionSettings}
7
+ * @param callbacks {@link WebRtcOptions}
8
+ */
9
+ export declare const establishFullConnection: (connectionSettings: ConnectionSettings, callbacks: WebRtcOptions, configProperties?: ConfigProperties) => Promise<void>;
@@ -1,3 +1,3 @@
1
- export * from "./channels";
2
- export * from "./signalR";
3
- export * from "./webRTC";
1
+ export * from "./channels";
2
+ export * from "./signalR";
3
+ export * from "./webRTC";
@@ -1,12 +1,12 @@
1
- import { HubConnection } from "@microsoft/signalr";
2
- import { ConfigProperties, ConnectionSettings } from "@types";
3
- /**
4
- * Connect to Server
5
- *
6
- * Attempts to connect to the signaling server
7
- * @param onConnectionSuccess The callback provided that returns the connected {@link HubConnection}
8
- * @param connectionSettings {@link ConnectionSettings} The provided connection settings used to determine what signaling server to connect other similar settings
9
- * @returns void
10
- *
11
- */
12
- export declare const connectToServer: (onConnectionSuccess: (socket: HubConnection) => void, connectionSettings: ConnectionSettings, configProperties: ConfigProperties) => Promise<void>;
1
+ import { HubConnection } from "@microsoft/signalr";
2
+ import { ConfigProperties, ConnectionSettings } from "@types";
3
+ /**
4
+ * Connect to Server
5
+ *
6
+ * Attempts to connect to the signaling server
7
+ * @param onConnectionSuccess The callback provided that returns the connected {@link HubConnection}
8
+ * @param connectionSettings {@link ConnectionSettings} The provided connection settings used to determine what signaling server to connect other similar settings
9
+ * @returns void
10
+ *
11
+ */
12
+ export declare const connectToServer: (onConnectionSuccess: (socket: HubConnection) => void, connectionSettings: ConnectionSettings, configProperties: ConfigProperties) => Promise<void>;
@@ -1,12 +1,12 @@
1
- import { HubConnection } from "@microsoft/signalr";
2
- import { ConfigProperties, WebRtcOptions } from "@types";
3
- export declare const peerConnections: Record<string, RTCPeerConnection | null>;
4
- export declare const closeAllPeerConnections: () => void;
5
- /**
6
- * Initialize WebRTC
7
- *
8
- * Negotiates a {@link RTCPeerConnection} with the provided {@link HubConnection} and relays information through the provided callbacks
9
- * @param socketRef The SignalR hub connection that will be used to negotiate the WebRTC connection
10
- * @param callbacks The grouping of callbacks that will return important information to the frontend
11
- */
12
- export declare const initializeWebRTC: (socketRef: HubConnection, callbacks: WebRtcOptions, configProperties: ConfigProperties) => void;
1
+ import { HubConnection } from "@microsoft/signalr";
2
+ import { ConfigProperties, WebRtcOptions } from "@types";
3
+ export declare const peerConnections: Record<string, RTCPeerConnection | null>;
4
+ export declare const closeAllPeerConnections: () => void;
5
+ /**
6
+ * Initialize WebRTC
7
+ *
8
+ * Negotiates a {@link RTCPeerConnection} with the provided {@link HubConnection} and relays information through the provided callbacks
9
+ * @param socketRef The SignalR hub connection that will be used to negotiate the WebRTC connection
10
+ * @param callbacks The grouping of callbacks that will return important information to the frontend
11
+ */
12
+ export declare const initializeWebRTC: (socketRef: HubConnection, callbacks: WebRtcOptions, configProperties: ConfigProperties) => void;
@@ -1,114 +1,114 @@
1
- import { HubConnection, LogLevel } from "@microsoft/signalr";
2
- /**
3
- * Answer Event
4
- *
5
- * An event triggered during the signaling process
6
- * @property {@link RTCSessionDescription} sdp: The session description protocol object. See WebRTC documentation for more details
7
- */
8
- export type AnswerEvent = {
9
- sdp: RTCSessionDescription;
10
- caller: string;
11
- };
12
- /**
13
- * Client
14
- *
15
- * A structure used for the signaling mechanism to identify connected users
16
- *
17
- * @property {@link string} client_id: The human-readable name that a client provides to the signaling server
18
- * @property {@link string} connection_id: The generated ID for a given client provided by the signaling server
19
- */
20
- export type Client = {
21
- client_id: string;
22
- connection_id: string;
23
- };
24
- /**
25
- * Session Info
26
- *
27
- * The session info used to generate a {@link RTCPeerConnection}
28
- *
29
- * @property {@link string} session_id: The session id provided by the signaling server
30
- * @property {@link string} connection_id: The vehicle's connection id generated by the signaling server
31
- * @property {@link Client}[] clients: The array of clients that are currently connected to this session
32
- */
33
- export type SessionInfo = {
34
- session_id: string;
35
- connection_id: string;
36
- clients: Client[];
37
- };
38
- /**
39
- * Connection State
40
- *
41
- * Used to describe the current state of the connection process
42
- * @readonly
43
- * @enum
44
- * @member Searching - The connection process has not started yet
45
- * @member Connecting - Attempting to connect to the signaling server
46
- * @member Connected - The connection has been established and WebRTC is being initialized
47
- * @member Error - An error occurred when during the connection process
48
- * @member SSL - The system detected a potential SSL validation error.
49
- * @member Ready - The connection is successful and both systems are able to communicate.
50
- */
51
- export declare enum ConnectionState {
52
- Searching = 0,
53
- Connecting = 1,
54
- Connected = 2,
55
- Error = 3,
56
- SSL = 4,
57
- Ready = 5
58
- }
59
- /**
60
- * Connection Settings
61
- *
62
- * These properties are used to customize the signaling server connection process.
63
- *
64
- * @property {string} ip: The desired ip address to connect to. If none are provided uses the [default ip address]({@link SIGNAL_SERVER_CONNECTION_STRING})
65
- * @property {boolean} reconnection: Indicates that the initial connection failed and now the system is attempting to connect again
66
- * @property {boolean} isElectron: Indicates whether or not the library is being used in an Electron application. Prevents certain states from being reached if it is.
67
- * @property {callback} onConnectionStateChange:
68
- * @property {callback} onDeviceError:
69
- */
70
- export interface ConnectionSettings {
71
- ip?: string;
72
- reconnection?: boolean;
73
- isElectron?: boolean;
74
- connectionState?: ConnectionState;
75
- onConnectionStateChange?: (newState: ConnectionState) => void;
76
- onDeviceError?: (deviceError: boolean) => void;
77
- onSocketConnected?: (socket: HubConnection) => void;
78
- }
79
- /**
80
- * WebRTC Options
81
- *
82
- * These callback functions provide access to important elements generated within this library
83
- *
84
- * @property {callback} onDataChannel: Triggered whenever a datachannel is created/received. Passes the newly created datachannel back
85
- * @property {callback} onTrackEvent: Triggered whenever a track event is received. Passes the new track back
86
- * @property {callback} onSessionList: Triggered whenever a session info event occurs. Passes the updated session info back
87
- * @property {callback} onJoinSession: Triggered whenever a session is joined. Passes back the session id of the joined session
88
- * @property {callback} onSessionClose: Triggered whenever the connection closes. No values are passed back
89
- * @property {callback} onConnectionStateChange: Triggered whenever the {@link RTCPeerConnection} state changes. Passes back the event
90
- * @property {callback} onError: Triggered whenever an error is encountered. Passes back the error
91
- */
92
- export interface WebRtcOptions {
93
- onDataChannel: (dataChannel: RTCDataChannelEvent) => void;
94
- onTrackEvent: (trackEvent: RTCVideoTrackInfo) => void;
95
- onSessionList: (sessionList: SessionInfo[], callback: (session: SessionInfo) => void) => void;
96
- onJoinSession: (session: SessionInfo) => void;
97
- onSessionClose: () => void;
98
- onConnectionStateChange: (event: Event) => void;
99
- onError: (reason: unknown) => void;
100
- onSessionInfo: (session: SessionInfo, call: (session: SessionInfo, connectionId: string) => void) => string | undefined;
101
- }
102
- export interface ConfigProperties {
103
- connectionTimeout?: number;
104
- abortConnectionTimeout?: number;
105
- defaultPort?: number;
106
- defaultAddress?: string;
107
- defaultConnectionString?: string;
108
- clientId?: string;
109
- socketLogging?: LogLevel;
110
- }
111
- export type RTCVideoTrackInfo = {
112
- trackEvent: RTCTrackEvent;
113
- label: string;
114
- };
1
+ import { HubConnection, LogLevel } from "@microsoft/signalr";
2
+ /**
3
+ * Answer Event
4
+ *
5
+ * An event triggered during the signaling process
6
+ * @property {@link RTCSessionDescription} sdp: The session description protocol object. See WebRTC documentation for more details
7
+ */
8
+ export type AnswerEvent = {
9
+ sdp: RTCSessionDescription;
10
+ caller: string;
11
+ };
12
+ /**
13
+ * Client
14
+ *
15
+ * A structure used for the signaling mechanism to identify connected users
16
+ *
17
+ * @property {@link string} client_id: The human-readable name that a client provides to the signaling server
18
+ * @property {@link string} connection_id: The generated ID for a given client provided by the signaling server
19
+ */
20
+ export type Client = {
21
+ client_id: string;
22
+ connection_id: string;
23
+ };
24
+ /**
25
+ * Session Info
26
+ *
27
+ * The session info used to generate a {@link RTCPeerConnection}
28
+ *
29
+ * @property {@link string} session_id: The session id provided by the signaling server
30
+ * @property {@link string} connection_id: The vehicle's connection id generated by the signaling server
31
+ * @property {@link Client}[] clients: The array of clients that are currently connected to this session
32
+ */
33
+ export type SessionInfo = {
34
+ session_id: string;
35
+ connection_id: string;
36
+ clients: Client[];
37
+ };
38
+ /**
39
+ * Connection State
40
+ *
41
+ * Used to describe the current state of the connection process
42
+ * @readonly
43
+ * @enum
44
+ * @member Searching - The connection process has not started yet
45
+ * @member Connecting - Attempting to connect to the signaling server
46
+ * @member Connected - The connection has been established and WebRTC is being initialized
47
+ * @member Error - An error occurred when during the connection process
48
+ * @member SSL - The system detected a potential SSL validation error.
49
+ * @member Ready - The connection is successful and both systems are able to communicate.
50
+ */
51
+ export declare enum ConnectionState {
52
+ Searching = 0,
53
+ Connecting = 1,
54
+ Connected = 2,
55
+ Error = 3,
56
+ SSL = 4,
57
+ Ready = 5
58
+ }
59
+ /**
60
+ * Connection Settings
61
+ *
62
+ * These properties are used to customize the signaling server connection process.
63
+ *
64
+ * @property {string} ip: The desired ip address to connect to. If none are provided uses the [default ip address]({@link SIGNAL_SERVER_CONNECTION_STRING})
65
+ * @property {boolean} reconnection: Indicates that the initial connection failed and now the system is attempting to connect again
66
+ * @property {boolean} isElectron: Indicates whether or not the library is being used in an Electron application. Prevents certain states from being reached if it is.
67
+ * @property {callback} onConnectionStateChange:
68
+ * @property {callback} onDeviceError:
69
+ */
70
+ export interface ConnectionSettings {
71
+ ip?: string;
72
+ reconnection?: boolean;
73
+ isElectron?: boolean;
74
+ connectionState?: ConnectionState;
75
+ onConnectionStateChange?: (newState: ConnectionState) => void;
76
+ onDeviceError?: (deviceError: boolean) => void;
77
+ onSocketConnected?: (socket: HubConnection) => void;
78
+ }
79
+ /**
80
+ * WebRTC Options
81
+ *
82
+ * These callback functions provide access to important elements generated within this library
83
+ *
84
+ * @property {callback} onDataChannel: Triggered whenever a datachannel is created/received. Passes the newly created datachannel back
85
+ * @property {callback} onTrackEvent: Triggered whenever a track event is received. Passes the new track back
86
+ * @property {callback} onSessionList: Triggered whenever a session info event occurs. Passes the updated session info back
87
+ * @property {callback} onJoinSession: Triggered whenever a session is joined. Passes back the session id of the joined session
88
+ * @property {callback} onSessionClose: Triggered whenever the connection closes. No values are passed back
89
+ * @property {callback} onConnectionStateChange: Triggered whenever the {@link RTCPeerConnection} state changes. Passes back the event
90
+ * @property {callback} onError: Triggered whenever an error is encountered. Passes back the error
91
+ */
92
+ export interface WebRtcOptions {
93
+ onDataChannel: (dataChannel: RTCDataChannelEvent) => void;
94
+ onTrackEvent: (trackEvent: RTCVideoTrackInfo) => void;
95
+ onSessionList: (sessionList: SessionInfo[], callback: (session: SessionInfo) => void) => void;
96
+ onJoinSession: (session: SessionInfo) => void;
97
+ onSessionClose: () => void;
98
+ onConnectionStateChange: (event: Event) => void;
99
+ onError: (reason: unknown) => void;
100
+ onSessionInfo: (session: SessionInfo, call: (session: SessionInfo, connectionId: string) => void) => string | undefined;
101
+ }
102
+ export interface ConfigProperties {
103
+ connectionTimeout?: number;
104
+ abortConnectionTimeout?: number;
105
+ defaultPort?: number;
106
+ defaultAddress?: string;
107
+ defaultConnectionString?: string;
108
+ clientId?: string;
109
+ socketLogging?: LogLevel;
110
+ }
111
+ export type RTCVideoTrackInfo = {
112
+ trackEvent: RTCTrackEvent;
113
+ label: string;
114
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deeptrekker/api-channels",
3
- "version": "0.7.0",
3
+ "version": "0.7.2-testingconnectionfix.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,11 +11,14 @@
11
11
  "dist/*"
12
12
  ],
13
13
  "scripts": {
14
- "build": "rollup -c"
14
+ "build": "rollup -c",
15
+ "clean-publish": "yarn && node scripts/publish.js"
15
16
  },
16
17
  "dependencies": {
17
18
  "@microsoft/signalr": "^8.0.0",
18
19
  "@types/sdp-transform": "^2.4.6",
20
+ "dotenv-flow": "^4.1.0",
21
+ "fs-extra": "^11.3.2",
19
22
  "lodash": "^4.17.21",
20
23
  "sdp-transform": "^2.14.1"
21
24
  },