Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function client(options = {}) {
const {resource, credentials, username, password, ...params} = options
const {domain, service} = params
if (!domain && service) {
params.domain = getDomain(service)
}
const entity = new Client(params)
const reconnect = _reconnect({entity})
const websocket = _websocket({entity})
const middleware = _middleware({entity})
const streamFeatures = _streamFeatures({middleware})
const iqCaller = _iqCaller({middleware, entity})
const iqCallee = _iqCallee({middleware, entity})
const resolve = _resolve({entity})
// Stream features - order matters and define priority
const sasl = _sasl({streamFeatures}, credentials || {username, password})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
// SASL mechanisms - order matters and define priority
const mechanisms = Object.entries({plain, anonymous}).map(([k, v]) => ({
[k]: v(sasl),
function client(options = {}) {
const {resource, credentials, username, password, ...params} = options
const {domain, service} = params
if (!domain && service) {
params.domain = getDomain(service)
}
const entity = new Client(params)
const reconnect = _reconnect({entity})
const websocket = _websocket({entity})
const tcp = _tcp({entity})
const tls = _tls({entity})
const middleware = _middleware({entity})
const streamFeatures = _streamFeatures({middleware})
const iqCaller = _iqCaller({middleware, entity})
const iqCallee = _iqCallee({middleware, entity})
const resolve = _resolve({entity})
// Stream features - order matters and define priority
const starttls = _starttls({streamFeatures})
const sasl = _sasl({streamFeatures}, credentials || {username, password})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
function client(options = {}) {
const {resource, credentials, username, password, ...params} = options
const {domain, service} = params
if (!domain && service) {
params.domain = getDomain(service)
}
const entity = new Client(params)
const reconnect = _reconnect({entity})
const websocket = _websocket({entity})
const middleware = _middleware({entity})
const streamFeatures = _streamFeatures({middleware})
const iqCaller = _iqCaller({middleware, entity})
const iqCallee = _iqCallee({middleware, entity})
const resolve = _resolve({entity})
// Stream features - order matters and define priority
const sasl = _sasl({streamFeatures}, credentials || {username, password})
const resourceBinding = _resourceBinding({iqCaller, streamFeatures}, resource)
const sessionEstablishment = _sessionEstablishment({iqCaller, streamFeatures})
// SASL mechanisms - order matters and define priority
const mechanisms = Object.entries({plain, anonymous}).map(([k, v]) => ({
[k]: v(sasl),