-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type defs #5
Draft
augustblack
wants to merge
25
commits into
meetecho:master
Choose a base branch
from
augustblack:type_defs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Type defs #5
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9e27a45
initial type definitions added
augustblack a182783
set Connection as return type
augustblack 1ec9c38
use "moduleResolution": "nodenext"
augustblack d0d59eb
fix typos
augustblack 7e2c227
fix EventEmitter and ./plugins import
augustblack 9ffb6d2
Merge branch 'master' into type_defs
augustblack a4b1949
Merge branch 'master' into type_defs
augustblack 94b1120
add TRICKLE
augustblack 0fc15a6
update JOINED response type
augustblack d48266f
add types/**/* to files
augustblack 6d001f9
Add partial support for multistream "updated" videoroom event
atoppi 6da160a
Fixes by npm audit
atoppi eebcf74
Bump version to v1.6.2
atoppi 3696a67
Add support for "enable_recording" API in the audiobridge plugin
atoppi 0295d07
add enableRecording types
augustblack 0c3f23f
Merge branch 'master' into type_defs
augustblack 6e7d04f
add rec_dir and startForward ptype, ssrc, codec
augustblack d059b30
Merge branch 'master' into type_defs
augustblack 023f9b4
add host_family to startForward
augustblack 46f2f30
format and add host_family
augustblack ab5c8cc
Merge branch 'master' into type_defs
augustblack da4ebe6
Merge branch 'master' into type_defs
augustblack f6d4e8a
update for suspend/resume requests
augustblack 81d6a14
Merge branch 'master' into type_defs
augustblack a7c0716
add mute / unmute to audiobridge
augustblack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
"description": "Meetecho adapter for the Janus WebRTC Server", | ||
"version": "1.6.9", | ||
"type": "module", | ||
"main": "src/janode.js", | ||
"types": "./types/janode.d", | ||
"keywords": [ | ||
"janus", | ||
"webrtc", | ||
|
@@ -24,16 +26,48 @@ | |
"license": "ISC", | ||
"main": "./src/janode.js", | ||
"exports": { | ||
".": "./src/janode.js", | ||
"./plugins/audiobridge": "./src/plugins/audiobridge-plugin.js", | ||
"./plugins/echotest": "./src/plugins/echotest-plugin.js", | ||
"./plugins/streaming": "./src/plugins/streaming-plugin.js", | ||
"./plugins/videoroom": "./src/plugins/videoroom-plugin.js" | ||
".": { | ||
"import": { | ||
"types": "./types/janode.d.ts", | ||
"default": "./src/janode.js" | ||
} | ||
}, | ||
"./plugins/echotest": { | ||
"import": { | ||
"types": "./types/plugins/echotest-plugin.d.ts", | ||
"default": "./src/plugins/echotest-plugin.js" | ||
} | ||
}, | ||
"./plugins/streaming": { | ||
"import": { | ||
"types": "./types/plugins/streaming-plugin.d.ts", | ||
"default": "./src/plugins/streaming-plugin.js" | ||
} | ||
}, | ||
"./plugins/videoroom": { | ||
"import": { | ||
"types": "./types/plugins/videoroom-plugin.d.ts", | ||
"default": "./src/plugins/videoroom-plugin.js" | ||
} | ||
}, | ||
"./plugins/audiobridge": { | ||
"import": { | ||
"types": "./types/plugins/audiobridge-plugin.d.ts", | ||
"default": "./src/plugins/audiobridge-plugin.js" | ||
} | ||
}, | ||
"./session": { | ||
"import": "./types/session.d.ts" | ||
}, | ||
"./connection": { | ||
"import": "./types/connection.d.ts" | ||
} | ||
}, | ||
"files": [ | ||
"src/*.js", | ||
"src/utils/*.js", | ||
"src/plugins/*.js" | ||
"src/plugins/*.js", | ||
"types/**/*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer specifying subfolders and file extension here (likewise the js) |
||
], | ||
"dependencies": { | ||
"isomorphic-ws": "^4.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ServerObjectConf } from './janode.js' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why are we importing |
||
export default Configuration; | ||
/** | ||
* Class representing a Janode configuration. | ||
* The purpose of the class is basically filtering the input config and distinguish Janus API and Admin API connections. | ||
*/ | ||
type AddressConfig = { | ||
url: string | ||
apisecret?: string | ||
} | ||
declare class Configuration { | ||
/** | ||
* Create a configuration. | ||
* | ||
* @private | ||
* @param {module:janode~RawConfiguration} config | ||
*/ | ||
private constructor(); | ||
address: AddressConfig[]; | ||
retry_time_secs: number; | ||
max_retries: number; | ||
is_admin: boolean; | ||
/** | ||
* Get the server list of this configuration. | ||
* | ||
* @returns {module:janode~ServerObjectConf[]} The address array | ||
*/ | ||
getAddress(): ServerObjectConf; | ||
/** | ||
* Get the number of seconds between any attempt. | ||
* | ||
* @returns {number} The value of the property | ||
*/ | ||
getRetryTimeSeconds(): number; | ||
/** | ||
* Get the max number of retries. | ||
* | ||
* @returns {number} The value of the property | ||
*/ | ||
getMaxRetries(): number; | ||
/** | ||
* Check if the configuration is for an admin connection. | ||
* | ||
* @returns {boolean} True if the configuration will be used for an admin connection | ||
*/ | ||
isAdmin(): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
import Session from './session.js' | ||
import { EventEmitter } from 'events' | ||
export default Connection; | ||
/** | ||
* Class representing a Janode connection.<br> | ||
* | ||
* Specific transports are picked by checking the connection URI.<br> | ||
* | ||
* This class implements both the Janus API and Admin API.<br> | ||
* | ||
* Connection extends EventEmitter, so an instance can emit events and users can subscribe to them.<br> | ||
* | ||
* Users are not expected to create Connection instances, but insted use the Janode.connect() API.<br> | ||
* | ||
* @hideconstructor | ||
*/ | ||
declare class Connection extends EventEmitter { | ||
/** | ||
* Create a Janode Connection. | ||
* | ||
* @param {module:configuration~Configuration} server_config - The Janode configuration as created by the Configuration constructor. | ||
*/ | ||
constructor(server_config: any); | ||
/** | ||
* The configuration in use for this connection. | ||
* | ||
* @private | ||
* @type {module:configuration~Configuration} | ||
*/ | ||
private _config; | ||
/** | ||
* The transaction manager used by this connection. | ||
* | ||
* @private | ||
* @type {module:tmanager~TransactionManager} | ||
*/ | ||
private _tm; | ||
/** | ||
* Keep track of the sessions. | ||
* | ||
* @private | ||
* @type {Map} | ||
*/ | ||
private _sessions; | ||
/** | ||
* The iterator to select available Janus addresses. | ||
* | ||
* @private | ||
* @type {module:utils~CircularIterator} | ||
*/ | ||
private _address_iterator; | ||
/** | ||
* A numerical identifier assigned for logging purposes. | ||
* | ||
* @type {number} | ||
*/ | ||
id: number; | ||
/** | ||
* A more descriptive, not unique string (used for logging). | ||
* | ||
* @type {string} | ||
*/ | ||
name: string; | ||
/** | ||
* The internal transport that will be used for the connection. | ||
* | ||
* @typedef {object} Transport | ||
* @property {function} open | ||
* @property {function} close | ||
* @property {function} send | ||
* @property {function} getRemoteHostname | ||
*/ | ||
_transport: WsTransport | UnixTransport | { | ||
open: (_: any) => Promise<never>; | ||
close: (_: any) => Promise<never>; | ||
send: (_: any) => Promise<never>; | ||
getRemoteHostname: (_: any) => never; | ||
}; | ||
/** | ||
* Cleanup the connection closing all owned transactions and emitting the destroyed event | ||
* and removing all registered listeners. | ||
* | ||
* @private | ||
* @param {boolean} graceful - True if this is an expected disconnection | ||
*/ | ||
private _signalClose; | ||
/** | ||
* Open a connection using the transport defined open method. | ||
* Users do not need to call this method, since the connection is opened by Janode.connect(). | ||
* | ||
* @returns {Promise<module:connection~Connection>} A promise resolving with the Janode connection | ||
*/ | ||
open(): Promise<Connection>; | ||
/** | ||
* Manage a message sent to this session. If a session is involved let it manage the message. | ||
* If the message involves a owned transaction and the response is a definitive one, | ||
* the transaction will be closed. | ||
* | ||
* @private | ||
* @param {object} janus_message | ||
*/ | ||
private _handleMessage; | ||
/** | ||
* Decorate request with apisecret, token and transaction (if missing). | ||
* | ||
* @private | ||
* @param {object} request | ||
*/ | ||
private _decorateRequest; | ||
/** | ||
* Gracefully close the connection using the transport defined close method. | ||
* | ||
* @returns {Promise<void>} | ||
*/ | ||
close(): Promise<void>; | ||
/** | ||
* Send a request from this connection using the transport defined send method. | ||
* | ||
* @param {object} request - The request to be sent | ||
* @returns {Promise<object>} A promise resolving with a response from Janus | ||
*/ | ||
sendRequest(request: object): Promise<object>; | ||
/** | ||
* Get the remote Janus hostname using the transport defined method. | ||
* | ||
* @returns {string} The hostname of the Janus server | ||
*/ | ||
getRemoteHostname(): string; | ||
/** | ||
* Create a new session in this connection. | ||
* | ||
* @param {number} [ka_interval] - The time interval (seconds) for session keep-alive requests | ||
* @returns {Promise<module:session~Session>} The newly created session | ||
* | ||
* @example | ||
* | ||
* const session = await connection.create(); | ||
* Logger.info(`***** SESSION CREATED *****`); | ||
*/ | ||
create(ka_interval?: number): Promise<Session>; | ||
/** | ||
* Janus GET INFO API. | ||
* | ||
* @returns {Promise<object>} The Get Info response | ||
* | ||
* @example | ||
* | ||
* const info = await connection.getInfo(); | ||
* Logger.info(`${info.name} ${info.version_string}`); | ||
*/ | ||
getInfo(): Promise<object>; | ||
/*************/ | ||
/*************/ | ||
/** | ||
* (Admin API) List the sessions in a janus instance. | ||
* | ||
* @returns {Promise<object>} | ||
* | ||
* @example | ||
* | ||
* const data = await connection.listSessions(); | ||
* Logger.info(`${JSON.stringify(data)}`); | ||
*/ | ||
listSessions(): Promise<object>; | ||
/** | ||
* (Admin API) List the handles in a session. | ||
* | ||
* @param {number} session_id - The identifier of the session | ||
* @returns {Promise<object>} | ||
* | ||
* @example | ||
* | ||
* const data = await connection.listSessions(); | ||
* Logger.info(`${JSON.stringify(data)}`); | ||
*/ | ||
listHandles(session_id: number): Promise<object>; | ||
/** | ||
* (Admin API) Get an handle info. | ||
* | ||
* @param {number} session_id - The session identifier | ||
* @param {number} handle_id - The handle identifier | ||
* @returns {Promise<object>} The Get Handle Info response | ||
* | ||
* @example | ||
* | ||
* const data = await connection.handleInfo(session.id, handle.id); | ||
* Logger.info(`${JSON.stringify(data)}`); | ||
*/ | ||
handleInfo(session_id: number, handle_id: number): Promise<object>; | ||
/** | ||
* (Admin API) Start a packet capture on an handle. | ||
* | ||
* @param {number} session_id - The session identifier | ||
* @param {number} handle_id - The handle identifier | ||
* @param {string} folder - The folder in which save the pcap | ||
* @param {string} filename - The pcap file name | ||
* @param {number} [truncate] - Number of bytes to truncate the pcap to | ||
* @returns {Promise<object>} The start pcap response | ||
*/ | ||
startPcap(session_id: number, handle_id: number, folder: string, filename: string, truncate?: number): Promise<object>; | ||
/** | ||
* Stop an ogoing packet capture. | ||
* | ||
* @param {number} session_id - The session identifier | ||
* @param {number} handle_id - The handle identifier | ||
* @returns {Promise<object>} The stop pcap response | ||
*/ | ||
stopPcap(session_id: number, handle_id: number): Promise<any>; | ||
} | ||
import WsTransport from "./transport-ws.js"; | ||
import UnixTransport from "./transport-unix.js"; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a typo?