New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dlghq/dialog-node-client

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dlghq/dialog-node-client - npm Package Compare versions

Comparing version 0.0.0 to 0.1.1

.editorconfig

6

examples/auth.js
const path = require('path');
const createClient = require('./src');
const createClient = require('../src');

@@ -16,3 +16,3 @@ createClient({

messenger.requestSms(
'75555555555',
'75555555555',
() => messenger.sendCode('5555', () => resolve(messenger), onError),

@@ -24,5 +24,5 @@ onError

}).then((messenger) => {
// do something with messenger
console.log('my uid: ', messenger.getUid());
}).catch((error) => {
console.trace(error);
});
{
"name": "@dlghq/dialog-node-client",
"version": "0.0.0",
"version": "0.1.1",
"main": "src/index.js",

@@ -8,5 +8,7 @@ "author": "Nikita Gusakov <gusnkt@gmail.com>",

"dependencies": {
"@dlghq/dialog-java-core": "^1.0.745",
"@dlghq/dialog-java-core": "^1.0.753",
"chalk": "1.1.3",
"jsdom": "9.12.0",
"ws": "2.2.2"
}
}

@@ -19,2 +19,3 @@ Dialog Node.js client

createClient({
quiet: false, // by default
endpoints: ['wss://ws1.dlg.im'],

@@ -28,1 +29,3 @@ storageFileName: path.join(__dirname, 'storage.json')

```
[More examples](examples/)
const patchScope = require('./patch-scope');
const log = require('./logger');
function createClient({ storageFileName, endpoints }) {
function createClient({ storageFileName, endpoints, quiet }) {
patchScope({ storageFileName });

@@ -14,3 +15,4 @@

apiAppId: 4,
apiAppKey: '278f13e07eee8398b189bced0db2cf66703d1746e2b541d85f5b42b1641aae0e'
apiAppKey: '278f13e07eee8398b189bced0db2cf66703d1746e2b541d85f5b42b1641aae0e',
logHandler: quiet ? () => {} : log
}, (core) => {

@@ -17,0 +19,0 @@ resolve(core);

@@ -1,70 +0,52 @@

const WebSocket = require('ws');
const fs = require('fs');
const path = require('path');
const { jsdom } = require('jsdom');
const LocalStorage = require('./LocalStorage');
function patchScope({ storageFileName }) {
const localStorage = new LocalStorage(storageFileName);
const html = '<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>';
const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36';
function addEventListener(eventName, callback) {
if (eventName === 'DOMContentLoaded') {
callback({});
}
}
const document = jsdom(html, { userAgent });
const window = document.defaultView;
const document = {
addEventListener,
write(text) {},
getElementById(id) {
return {
parentNode: {
removeChild() {}
}
};
},
getElementsByTagName(name) {
return [];
},
createElement() {
return {};
}
};
const storage = new LocalStorage(storageFileName);
const navigator = {
appCodeName: 'Mozilla',
language: 'en-US',
languages: ['en', 'en-US'],
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
};
Object.assign(window, {
window,
document,
WebSocket: require('ws'),
localStorage: storage,
sessionStorage: storage
});
const location = {
hash: '#/auth',
host: 'app.dlg.im',
href: 'https://app.dlg.im/#/auth',
pathname: '/',
port: '',
protocol: 'https:',
search: ''
};
const keys = [
'window',
'document',
'location',
'navigator',
'localStorage',
'sessionStorage',
global.window = global;
'Blob',
'File',
'Event',
'WebSocket',
'FileReader',
'XMLHttpRequest'
];
Object.assign(window, {
WebSocket,
document,
location,
navigator,
localStorage,
addEventListener,
alert(message) {
throw new Error(`Alert: ${message}`);
}
keys.forEach((key) => {
global[key] = window[key];
});
Object.assign(document, {
location,
navigator
});
File.create = (filePathName) => {
const content = fs.readFileSync(filePathName);
const fileName = path.basename(filePathName);
return new File([content], fileName);
};
document.dispatchEvent(new Event('DOMContentLoaded'));
}
module.exports = patchScope;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc