Socket
Socket
Sign inDemoInstall

@feathersjs/socket-commons

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@feathersjs/socket-commons - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

11

CHANGELOG.md
# Change Log
## [v3.0.1](https://github.com/feathersjs/socket-commons/tree/v3.0.1) (2017-11-03)
[Full Changelog](https://github.com/feathersjs/socket-commons/compare/v3.0.0...v3.0.1)
**Closed issues:**
- Allow socket calls without params and callback [\#54](https://github.com/feathersjs/socket-commons/issues/54)
**Merged pull requests:**
- Allow socket calls without query and callback [\#55](https://github.com/feathersjs/socket-commons/pull/55) ([daffl](https://github.com/daffl))
## [v3.0.0](https://github.com/feathersjs/socket-commons/tree/v3.0.0) (2017-11-01)

@@ -4,0 +15,0 @@ [Full Changelog](https://github.com/feathersjs/socket-commons/compare/v3.0.0-pre.7...v3.0.0)

28

lib/channels/index.js
const debug = require('debug')('@feathersjs/socket-commons/channels');
const { get, compact, flattenDeep } = require('lodash');
const { get, compact, flattenDeep, noop } = require('lodash');
const CombinedChannel = require('./channel/combined');

@@ -43,15 +43,21 @@ const { channelMixin, publishMixin, keys } = require('./mixins');

const appPublishers = app[PUBLISHERS];
const publishers = compact([
// This will return the first publisher list that is not empty
// In the following precedence
const callback = [
// 1. Service publisher for a specific event
get(servicePublishers, event),
// 2. Service publisher for all events
get(servicePublishers, ALL_EVENTS),
get(servicePublishers, event),
get(appPublishers, ALL_EVENTS),
get(appPublishers, event)
]);
// 3. App publishers for a specific event
get(appPublishers, event),
// 4. App publishers for all events
get(appPublishers, ALL_EVENTS)
].find(current => typeof current === 'function') || noop;
Promise.all(publishers.map(callback =>
Promise.resolve(callback(data, hook))
)).then(results => {
const channel = new CombinedChannel(compact(flattenDeep(results)));
Promise.resolve(callback(data, hook)).then(result => {
const channel = Array.isArray(result)
? new CombinedChannel(compact(flattenDeep(result)))
: result;
if (channel.length > 0) {
if (channel && channel.length > 0) {
app.emit('publish', event, channel, hook);

@@ -58,0 +64,0 @@ } else {

{
"name": "@feathersjs/socket-commons",
"description": "Shared functionality for websocket providers",
"version": "3.0.1",
"version": "3.1.0",
"homepage": "https://github.com/feathersjs/socket-commons",

@@ -6,0 +6,0 @@ "main": "lib/",

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