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

ibm-connections-blogs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-connections-blogs - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

81

lib/index.js

@@ -41,11 +41,14 @@ 'use strict';

const formatUrlTemplateOptions = _.merge({
valuesMap: {
authType: {
basic: '',
saml: '',
cookie: '',
const formatUrlTemplateOptions = _.merge(
{
valuesMap: {
authType: {
basic: '',
saml: '',
cookie: '',
},
},
},
}, plugins.formatUrlTemplate || {});
plugins.formatUrlTemplate || {}
);

@@ -71,19 +74,23 @@ httpClient.use(formatUrlTemplatePlugin(formatUrlTemplateOptions));

// construct the request options
const requestOptions = _.merge({
// defining defaults in here
qs: {
// despite the fact that the documentation for IBM Connections Cloud Blogs (6.0.0) says default value would be "1", it only works with "0"
// https://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Getting_a_feed_of_recent_posts_for_a_blog_ic50&content=apicontent
page: 0,
ps: 10, // max is 50
lang: 'en_us',
const requestOptions = _.merge(
{
// defining defaults in here
qs: {
// despite the fact that the documentation for IBM Connections Cloud Blogs (6.0.0) says default value would be "1", it only works with "0"
// https://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Getting_a_feed_of_recent_posts_for_a_blog_ic50&content=apicontent
page: 0,
ps: 10, // max is 50
lang: 'en_us',
},
},
}, omitDefaultRequestParams(options), {
qs: _.pick(query, qsValidParameters),
headers: {
accept: 'application/atom+xml',
},
ttl: params.ttl.blogPosts,
uri: `{ authType }/${query.handle}/feed/entries/atom`,
});
omitDefaultRequestParams(options),
{
qs: _.pick(query, qsValidParameters),
headers: {
accept: 'application/atom+xml',
},
ttl: params.ttl.blogPosts,
uri: `{ authType }/${query.handle}/feed/entries/atom`,
}
);

@@ -122,15 +129,19 @@ httpClient.makeRequest(requestOptions, (requestError, response, body) => {

// construct the request options
const requestOptions = _.merge({
// defining defaults in here
qs: {
lang: 'en_us',
const requestOptions = _.merge(
{
// defining defaults in here
qs: {
lang: 'en_us',
},
},
}, omitDefaultRequestParams(options), {
qs: _.pick(query, qsValidParameters),
headers: {
accept: 'application/atom+xml',
},
ttl: params.ttl.blogPost,
uri: `{ authType }/${query.handle}/api/entries/${query.entryId}`,
});
omitDefaultRequestParams(options),
{
qs: _.pick(query, qsValidParameters),
headers: {
accept: 'application/atom+xml',
},
ttl: params.ttl.blogPost,
uri: `{ authType }/${query.handle}/api/entries/${query.entryId}`,
}
);

@@ -137,0 +148,0 @@ httpClient.makeRequest(requestOptions, (requestError, response, body) => {

@@ -29,20 +29,29 @@ 'use strict';

const parseUserInfo = node => node && {
name: xpathSelect('string(atom:name/text())', node, true),
userId: xpathSelect('string(snx:userid/text())', node, true),
state: xpathSelect('string(snx:userState/text())', node, true),
external: xpathSelect('boolean(snx:isExternal/text())', node, true),
};
const parseUserInfo = node =>
node && {
name: xpathSelect('string(atom:name/text())', node, true),
userId: xpathSelect('string(snx:userid/text())', node, true),
state: xpathSelect('string(snx:userState/text())', node, true),
external: xpathSelect('boolean(snx:isExternal/text())', node, true),
};
const parseRecommendations = (entry, collection) => entry && collection && {
title: xpathSelect('string(atom:title/text())', collection, true),
href: xpathSelect('string(@href)', collection, true),
count: xpathSelect('number(snx:rank[@scheme="http://www.ibm.com/xmlns/prod/sn/recommendations"]/text())', entry, true),
};
const parseRecommendations = (entry, collection) =>
entry &&
collection && {
title: xpathSelect('string(atom:title/text())', collection, true),
href: xpathSelect('string(@href)', collection, true),
count: xpathSelect(
'number(snx:rank[@scheme="http://www.ibm.com/xmlns/prod/sn/recommendations"]/text())',
entry,
true
),
};
const parseComments = (entry, collection) => entry && collection && {
title: xpathSelect('string(atom:title/text())', collection, true),
href: xpathSelect('string(@href)', collection, true),
count: xpathSelect('number(snx:rank[@scheme="http://www.ibm.com/xmlns/prod/sn/comment"]/text())', entry, true),
};
const parseComments = (entry, collection) =>
entry &&
collection && {
title: xpathSelect('string(atom:title/text())', collection, true),
href: xpathSelect('string(@href)', collection, true),
count: xpathSelect('number(snx:rank[@scheme="http://www.ibm.com/xmlns/prod/sn/comment"]/text())', entry, true),
};

@@ -73,3 +82,4 @@ module.exports = (stringOrXMLDoc, isEntryNode) => {

'app:collection[atom:category[@term="recommend" and @scheme="http://www.ibm.com/xmlns/prod/sn/collection"]]',
entryNode, true
entryNode,
true
)

@@ -82,3 +92,4 @@ );

'app:collection[atom:category[@term="comments" and @scheme="http://www.ibm.com/xmlns/prod/sn/collection"]]',
entryNode, true
entryNode,
true
)

@@ -89,14 +100,18 @@ );

// link nodes are transformed into an object literal with properties "href" and "type"
const links = _.reduce(linkSelectors, (result, selector, key) => {
const linkNode = xpathSelect(selector, entryNode, true);
if (linkNode) {
Object.assign(result, {
[key]: {
href: linkNode.getAttribute('href'),
type: linkNode.getAttribute('type'),
},
});
}
return result;
}, {});
const links = _.reduce(
linkSelectors,
(result, selector, key) => {
const linkNode = xpathSelect(selector, entryNode, true);
if (linkNode) {
Object.assign(result, {
[key]: {
href: linkNode.getAttribute('href'),
type: linkNode.getAttribute('type'),
},
});
}
return result;
},
{}
);

@@ -115,3 +130,5 @@ const author = parseUserInfo(xpathSelect('atom:author', entryNode, true));

return Object.assign(post, { recommendations, comments, links, author, contributor });
return Object.assign(post, {
recommendations, comments, links, author, contributor,
});
};

@@ -16,4 +16,3 @@ 'use strict';

return _.map(xpathSelect('/atom:feed/atom:entry', xmlDoc), entryNode =>
blogPostParser(entryNode, true));
return _.map(xpathSelect('/atom:feed/atom:entry', xmlDoc), entryNode => blogPostParser(entryNode, true));
};
{
"name": "ibm-connections-blogs",
"version": "1.1.0",
"version": "1.1.1",
"description": "An IBM Connections Blogs API Wrapper",

@@ -13,21 +13,21 @@ "main": "lib/index.js",

"dependencies": {
"async": "2.5.0",
"lodash": "4.17.4",
"oniyi-http-client": "1.1.1",
"oniyi-http-plugin-credentials": "0.2.1",
"oniyi-http-plugin-format-url-template": "1.0.2",
"oniyi-logger": "1.0.0",
"oniyi-utils-xml": "1.0.0"
"async": "^2.5.0",
"lodash": "^4.17.4",
"oniyi-http-client": "^1.2.0",
"oniyi-http-plugin-credentials": "^0.2.1",
"oniyi-http-plugin-format-url-template": "^1.0.2",
"oniyi-logger": "^1.0.0",
"oniyi-utils-xml": "^1.1.0"
},
"devDependencies": {
"ava": "0.21.0",
"eslint": "3.15.0",
"eslint-config-oniyi": "4.4.0",
"eslint-plugin-ava": "4.2.1",
"nock": "9.0.14",
"nyc": "11.0.3"
"ava": "^0.22.0",
"eslint": "^4.8.0",
"eslint-config-oniyi": "^5.0.2",
"eslint-plugin-ava": "^4.2.2",
"nock": "^9.0.22",
"nyc": "^11.2.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/benkroeger/ibm-connections-blogs.git"
"url": "git+ssh://git@github.com/benkroeger/ibm-connections-blogs.git"
},

@@ -44,4 +44,4 @@ "author": "Benjamin Kroeger <benjamin.kroeger@gmail.com>",

"files": [
"lib"
"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