Socket
Socket
Sign inDemoInstall

forest-express

Package Overview
Dependencies
Maintainers
3
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forest-express - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

integrations/intercom/serializers/intercom-conversation.js

2

CHANGELOG.md

@@ -5,2 +5,4 @@ # Change Log

## RELEASE 1.3.3 - 2017-10-03
## RELEASE 1.3.2 - 2017-10-02

@@ -7,0 +9,0 @@ ### Fixed

49

integrations/intercom/routes.js
'use strict';
var _ = require('lodash');
var IntegrationInformationsGetter = require('./services/integration-informations-getter');
var IntercomAttributesGetter = require('./services/intercom-attributes-getter');
var IntercomAttributesSerializer = require('./serializers/intercom-attributes');
var IntercomConversationsGetter = require('./services/intercom-conversations-getter');
var IntercomConversationsSerializer = require('./serializers/intercom-conversations');
var AttributesGetter = require('./services/attributes-getter');
var AttributesSerializer = require('./serializers/intercom-attributes');
var ConversationsGetter = require('./services/conversations-getter');
var ConversationsSerializer = require('./serializers/intercom-conversations');
var ConversationGetter = require('./services/conversation-getter');
var ConversationSerializer = require('./serializers/intercom-conversation');
var auth = require('../../services/auth');

@@ -19,11 +21,11 @@

this.intercomAttributes = function (req, res, next) {
new IntercomAttributesGetter(Implementation, _.extend(req.query,
req.params), opts, integrationInfo)
this.getAttributes = function (request, response, next) {
new AttributesGetter(Implementation, _.extend(request.query, request.params), opts,
integrationInfo)
.perform()
.then(function (attributes) {
return new IntercomAttributesSerializer(attributes, modelName);
return new AttributesSerializer(attributes, modelName);
})
.then(function (attributes) {
res.send(attributes);
response.send(attributes);
})

@@ -33,12 +35,12 @@ .catch(next);

this.intercomConversations = function (req, res, next) {
new IntercomConversationsGetter(Implementation,_.extend(req.query,
req.params), opts, integrationInfo)
this.listConversations = function (request, response, next) {
new ConversationsGetter(Implementation, _.extend(request.query, request.params), opts,
integrationInfo)
.perform()
.spread(function (count, conversations) {
return new IntercomConversationsSerializer(conversations, modelName,
return new ConversationsSerializer(conversations, modelName,
{ count: count });
})
.then(function (conversations) {
res.send(conversations);
response.send(conversations);
})

@@ -48,11 +50,24 @@ .catch(next);

this.getConversation = function (request, response, next) {
new ConversationGetter(Implementation, _.extend(request.query, request.params), opts)
.perform()
.then(function (conversation) {
return new ConversationSerializer(conversation, modelName);
})
.then(function (conversation) {
response.send(conversation);
})
.catch(next);
};
this.perform = function () {
if (integrationInfo) {
app.get('/forest/' + modelName + '/:recordId/intercom_attributes',
auth.ensureAuthenticated, this.intercomAttributes);
auth.ensureAuthenticated, this.getAttributes);
app.get('/forest/' + modelName + '/:recordId/intercom_conversations',
auth.ensureAuthenticated, this.intercomConversations);
auth.ensureAuthenticated, this.listConversations);
app.get('/forest/' + modelName + '_intercom_conversations/:conversationId',
auth.ensureAuthenticated, this.getConversation);
}
};
};

@@ -21,3 +21,3 @@ 'use strict';

{ field: 'subject', type: 'String' },
{ field: 'body', type: ['String'], widget: 'link' },
{ field: 'body', type: ['String'] },
{ field: 'open', type: 'Boolean'},

@@ -24,0 +24,0 @@ { field: 'read', type: 'Boolean'},

{
"name": "forest-express",
"description": "Official package for all Forest Express Lianas",
"version": "1.3.2",
"version": "1.3.3",
"author": "Sandro Munda <sandro@munda.me>",

@@ -6,0 +6,0 @@ "contributors": [

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