Socket
Socket
Sign inDemoInstall

clang

Package Overview
Dependencies
118
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.4 to 1.0.5

48

lib/clang.js

@@ -72,2 +72,3 @@ 'use strict'

pagingArgs.size = requestArgs._size || 50
pagingArgs.all = requestArgs._allPages
delete requestArgs._offset

@@ -616,19 +617,36 @@ delete requestArgs._size

let setMethodName = setMethods[poll.msg.type]
api[setMethodName]({
uuid, resourceId,
offset : pagingArgs.offset,
size : pagingArgs.size
let pagesArgs = [...Array(1 * poll.msg.size)]
.map((item, index) => ({size: pagingArgs.size, offset: index}))
.filter(item => item.offset % pagingArgs.size === 0)
// [{"size":50,"offset":0},{"size":50,"offset":50},{"size":50,"offset":100}]
if (!pagingArgs.all) {
pagesArgs = pagesArgs.slice(0,1)
}
async.map(pagesArgs, (pagingArgs, cb) => {
api[setMethodName]({
uuid, resourceId,
offset: pagingArgs.offset,
size : pagingArgs.size
}, (err, result) => {
if (config.logPayload) {
console.log('payload outgoing', api.lastRequest)
}
if (err) {
if (config.debug) {
console.error('Error in getting resource set')
}
return cb(err)
}
// Turn the object with an array somewhere into an immediate array
cb(null, instance.normalizeOutput(setMethodName, result))
})
}, (err, result) => {
if (config.logPayload) {
console.log('payload outgoing', api.lastRequest)
// console.log('payload incoming', raw)
if (err) return cb(err)
// result is an array of arrays of records
// callback with one big array of all records combined
cb(null, [].concat(...result))
}
if (err) {
if (config.debug) {
console.error('Error in getting resource set')
}
return cb(err)
}
cb(null, instance.normalizeOutput(setMethodName, result))
})
)
},

@@ -635,0 +653,0 @@ freeResource: (getData, cb) => {

{
"name": "clang",
"version": "1.0.4",
"version": "1.0.5",
"description": "Node.js api wrapper for Clang's SOAP api",

@@ -5,0 +5,0 @@ "author": "Christiaan Westerbeek <chris@devotis.nl>",

@@ -24,2 +24,3 @@ [![Build Status](https://travis-ci.org/devotis/node-clang.svg)](https://travis-ci.org/devotis/node-clang)

## 1.0 new features
- You can supply `_allPages=true` in the clang.request params. Internally all pages will be fetched, normalized and concatenated into one array containing the results of all pages.
- The default platform is `secure`, but you can now configure it to be `login`.

@@ -52,2 +53,11 @@ ```javascript

})
// Let the clang request do the paging for you and get all results back
clang.request('customer_getAll', {
_allPages: true
}, (err, result) => {
console.log(err, result)
})
```

@@ -54,0 +64,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc