Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@4c/graphql-subscription-server

Package Overview
Dependencies
Maintainers
5
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@4c/graphql-subscription-server - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

CHANGELOG.md

22

es/AuthorizedSocketConnection.js

@@ -18,4 +18,18 @@ function _asyncIterator(iterable) { if (typeof Symbol === "function") { if (Symbol.asyncIterator) { var method = iterable[Symbol.asyncIterator]; if (method != null) return method.call(iterable); } if (Symbol.iterator) { return iterable[Symbol.iterator](); } } throw new TypeError("Object is not async iterable"); }

constructor(config) {
this.isAuthorized = data => !!(this.config.credentialsManager.isAuthenticated() && this.config.hasPermission(data, this.getCredentials()));
this.isAuthorized = data => {
const isAuthenticated = this.config.credentialsManager.isAuthenticated();
const credentials = this.getCredentials();
const isAuthorized = !!(isAuthenticated && this.config.hasPermission(data, credentials));
if (!isAuthorized) {
this.log('info', 'unauthorized', {
payload: data,
isAuthenticated,
credentials
});
}
return isAuthorized;
};
this.handleAuthenticate = async (authorization, cb) => {

@@ -123,5 +137,5 @@ try {

const payload = _value;
this.log('debug', 'processing subscription update', {
id,
payload
this.log('info', 'emit', {
payload,
credentials: this.getCredentials()
});

@@ -128,0 +142,0 @@ this.config.socket.emit('subscription update', {

@@ -29,4 +29,18 @@ "use strict";

constructor(config) {
this.isAuthorized = data => !!(this.config.credentialsManager.isAuthenticated() && this.config.hasPermission(data, this.getCredentials()));
this.isAuthorized = data => {
const isAuthenticated = this.config.credentialsManager.isAuthenticated();
const credentials = this.getCredentials();
const isAuthorized = !!(isAuthenticated && this.config.hasPermission(data, credentials));
if (!isAuthorized) {
this.log('info', 'unauthorized', {
payload: data,
isAuthenticated,
credentials
});
}
return isAuthorized;
};
this.handleAuthenticate = async (authorization, cb) => {

@@ -134,5 +148,5 @@ try {

const payload = _value;
this.log('debug', 'processing subscription update', {
id,
payload
this.log('info', 'emit', {
payload,
credentials: this.getCredentials()
});

@@ -139,0 +153,0 @@ this.config.socket.emit('subscription update', {

{
"name": "@4c/graphql-subscription-server",
"version": "0.1.1",
"version": "0.2.0",
"author": "4Catalyzer",

@@ -46,4 +46,10 @@ "license": "MIT",

},
"release": {
"extends": [
"@4c/semantic-release-config"
]
},
"devDependencies": {
"@4c/babel-preset-4catalyzer": "^1.3.0",
"@4c/semantic-release-config": "^1.0.1",
"@babel/cli": "^7.0.0-beta.43",

@@ -73,3 +79,4 @@ "@babel/core": "^7.0.0-beta.40",

"prettier": "^1.11.1",
"redis-mock": "^0.21.0"
"redis-mock": "^0.21.0",
"semantic-release": "^15.1.7"
},

@@ -83,3 +90,7 @@ "peerDependencies": {

"socket.io": "^2.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/4Catalyzer/graphql-subscription-server.git"
}
}

Sorry, the diff of this file is not supported yet

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