Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private extractConfig(uri: string) {
const parsedURI = parseUrl(uri);
const identity = parsedURI.user.split(':');
// Get params
const params = parsedURI.query;
const config = {
protocol: parsedURI.protocol,
host: parsedURI.resource,
port: parsedURI.port,
user: decodeURIComponent(identity[0]),
password: decodeURIComponent(identity[1]),
database: parsedURI.pathname.slice(1),
...params,
};
// Enforce
private _extractDatabaseConfig(databaseURI: string) {
const parsedURI = parseUrl(databaseURI);
const identity = parsedURI.user.split(':');
return {
protocol: parsedURI.protocol,
host: parsedURI.resource,
port: parsedURI.port,
user: identity[0],
password: identity[1],
schema: parsedURI.pathname.slice(1)
};
}
effect() {
const parsedUrl = parseUrl(url, true);
let command = parsedUrl.protocol + ' ' + (parsedUrl.user ? `${parsedUrl.user}@` : '') + parsedUrl.resource;
if (parsedUrl.port) command += ' -p ' + parsedUrl.port;
command += '\n';
rpc.once('session add', ({uid}) => {
rpc.once('session data', () => {
dispatch(sendSessionData(uid, command, null));
});
});
dispatch(requestSession());
}
});
getQuery(url) {
return queryString.parse(parseUrl(url).search);
}
});
const extractUrl = (url, method) => ({
handlers: routes[method],
pathname: parseUrl(url).pathname,
fullpath: parseUrl(url).href,
});
const extractUrl = (url, method) => ({
handlers: routes[method],
pathname: parseUrl(url).pathname,
fullpath: parseUrl(url).href,
});
const extractUrl = (
{ routes }: InterceptorConfig,
url: string,
method: string
) => ({
handlers: routes[method],
pathname: parseUrl(url).pathname,
fullpath: parseUrl(url).href
});
const extractUrl = (
{ routes }: InterceptorConfig,
url: string,
method: string
) => ({
handlers: routes[method],
pathname: parseUrl(url).pathname,
fullpath: parseUrl(url).href
});
export const getQuery = (url) => queryString.parse(parseUrl(url).search);