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

@sap/cds-messaging

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-messaging - npm Package Compare versions

Comparing version 1.1.1 to 1.2.1

12

CHANGELOG.md

@@ -9,2 +9,14 @@ # Changelog

## Version 1.2.1 - 2019-10-16
### Added
- `headers` parameter for `.emit`
## Version 1.2.0 - 2019-10-02
### Changed
- Minor improvements
## Version 1.1.1 - 2019-09-18

@@ -11,0 +23,0 @@

1

lib/client/Client.js

@@ -106,2 +106,3 @@ const FeatureNotSupportedError = require('../utils/FeatureNotSupported')

* @param {String} target to be sent to the queue(s).
* @param {Object} headers to be sent to the queue(s).
* @public

@@ -108,0 +109,0 @@ */

@@ -47,2 +47,3 @@ const { resolve } = require('../utils/thenable')

.catch(err => {
console.error(err)
const chain = errHandlers.reduce((chain, errHandler) => chain.then(() => errHandler(err)), resolve())

@@ -49,0 +50,0 @@ return chain.then(() => raw.done())

39

lib/client/messagingFunctions.js

@@ -164,3 +164,3 @@ const dataHandler = require('./dataHandler')

if (!csnEvent || (csnEvent.kind !== 'type' && csnEvent.kind !== 'event')) {
throw new Error(`Event '${normalizedHandler.event}' is not in model.`)
throw new Error(`Element '${normalizedHandler.event}' is not in model.`)
}

@@ -196,7 +196,2 @@ }

// FIXME: Dirty hack for TechEd
if (_event && _event.toUpperCase() === 'CREATED' && _entity === 'ServiceOrder') {
_topic = `sap/S4HANAOD/sun1/BO/ServiceOrder/Created`
_event = null
}
return { event: _event, entity: _entity, handler: _handler, topic: _topic }

@@ -222,4 +217,4 @@ }

function _emit (options) {
return function (event, entity, payload) {
if (!payload && entity && !event.startsWith('topic:') && !event.includes('/')) {
return function (event, entity, payload, header) {
if (!payload && entity && typeof event === 'string' && !event.startsWith('topic:') && !event.includes('/')) {
_checkValidEvent({ event }, options)

@@ -233,4 +228,4 @@ }

const [target, data] = _targetAndDataForEmit(payload, namespace, shrunkService, entity, event)
client.emit({ data }, target)
const [target, msg] = _getTargetAndMessage(payload, namespace, shrunkService, entity, event, header)
client.emit(msg, target)
this.release(client)

@@ -246,12 +241,18 @@ })

function _targetAndDataForEmit (payload, namespace, shrunkService, entity, event) {
return payload
? [`topic:${namespace}/${shrunkService}/${entity}/${event}`, payload]
function _handleEventAsString (payload, namespace, shrunkService, entity, event) {
return event.startsWith('topic:')
? [event, { data: entity, ...payload }]
: event.includes('/')
? [`topic:${event}`, { data: entity, ...payload }]
: [`topic:${namespace}/${shrunkService}/${event}`, { data: entity, ...payload }]
}
function _getTargetAndMessage (payload, namespace, shrunkService, entity, event, header) {
return typeof payload === 'object' && typeof entity !== 'object'
? [`topic:${namespace}/${shrunkService}/${entity}/${event}`, { data: payload, ...header }]
: entity
? event.startsWith('topic:')
? [event, entity]
: event.includes('/')
? [`topic:${event}`, entity]
: [`topic:${namespace}/${shrunkService}/${event}`, entity]
: [null, event]
? typeof event === 'string'
? _handleEventAsString(payload, namespace, shrunkService, entity, event)
: [null, { data: event, ...entity }]
: [null, { data: event, ...payload }]
}

@@ -258,0 +259,0 @@

@@ -1,1 +0,1 @@

{"bundleDependencies":false,"dependencies":{},"deprecated":false,"description":"","engines":{"node":">= 8.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"{lib,test}/**/*.js":["prettier-standard","standard --fix","git add"]},"main":"lib/index.js","name":"@sap/cds-messaging","version":"1.1.1","license":"SEE LICENSE IN developer-license-3.1.txt"}
{"bundleDependencies":false,"dependencies":{},"deprecated":false,"description":"","engines":{"node":">= 8.9.0"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"{lib,test}/**/*.js":["prettier-standard","standard --fix","git add"]},"main":"lib/index.js","name":"@sap/cds-messaging","version":"1.2.1","license":"SEE LICENSE IN developer-license-3.1.txt"}

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