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.5 to 1.0.6

73

lib/clang.js

@@ -79,10 +79,6 @@ 'use strict'

if (me.api) {
if (me.config.debug) {
console.log(`SOAP client already created`)
}
me.debug(`SOAP client already created`)
return setImmediate(callback)
}
if (me.config.debug) {
console.log(`Creating SOAP client...`)
}
me.debug(`Creating SOAP client...`)

@@ -94,5 +90,3 @@ soap.createClient(me.wsdl, (err, result) => {

if (me.config.debug) {
console.log(`SOAP client created`)
}
me.debug(`SOAP client created`)
me.api = result

@@ -118,5 +112,3 @@ me.description = result.describe()

if (me.config.debug) {
console.log(`Making SOAP request to ${methodName}...`)
}
me.debug(`Making SOAP request to ${methodName}...`)

@@ -133,5 +125,3 @@ fn(normalizedArgs, cb)

}
if (me.config.debug) {
console.log(`Incoming SOAP response ${JSON.stringify(obj).slice(0,50)}...`)
}
me.debug(`Incoming SOAP response ${JSON.stringify(obj).slice(0,50)}...`)
//Check for No SOAP Fault, but result code not 0

@@ -147,5 +137,3 @@ if (obj.code != 0) {

// this occurs for example when doing a customer_getByExternalId with a externalId that is not found
if (me.config.debug) {
console.log(`No records found in SOAP response (msg=null)`)
}
me.debug(`No records found in SOAP response (msg=null)`)
return setImmediate(cb.bind(null, null, []))

@@ -185,6 +173,6 @@ }

) {
console.log(`Incoming SOAP Fault ${JSON.stringify(faultBody)}, reduced to warning`)
me.debug(`Incoming SOAP Fault ${JSON.stringify(faultBody)}, reduced to warning`)
return cb(null, [{msg: true, warning: err.body}])
}
console.log(`Incoming SOAP Fault ${JSON.stringify(faultBody)}`)
me.debug(`Incoming SOAP Fault ${JSON.stringify(faultBody)}`)
return errAway(faultBody)

@@ -540,7 +528,6 @@ }

deleteAll: (getAll, prompt, cb) => {
console.log('prompt', prompt)
if (!prompt.answer.match(/y[es]*/i)) {
return setImmediate(cb)
}
console.log(`Deleting ${getAll.length} ${resourceName}s...`)
me.debug(`Deleting ${getAll.length} ${resourceName}s...`)
async.map(getAll, (item, cb) => {

@@ -556,2 +543,7 @@ if (resourceName === 'customer') {

}
debug () {
if (!this.config.debug) return false
console.log(...arguments)
}
}

@@ -580,15 +572,11 @@

async.doWhilst(cb => {
if (config.debug) {
console.log(`Checking state of resource: ${resourceId} for ${methodName}`)
}
instance.debug(`Checking state of resource: ${resourceId} for ${methodName}`)
api.resource_getById({ uuid, resourceId }, (err, result) => {
if (err) return cb(err)
if (config.debug) {
console.log(`Resource ${result.msg.type} = ${result.msg.status} (id: ${result.msg.id}, records: ${result.msg.size})`)
}
instance.debug(`Resource ${result.msg.type} = ${result.msg.status} (id: ${result.msg.id}, records: ${result.msg.size})`)
if (result && result.msg.status === 'ERROR') {
return cb(new Error(`Error getting resource ${resourceId} (probably incorrect x_getByObject request parameters)`))
return cb(new Error(`Error getting resource ${resourceId} of type ${result.msg.type} (probably incorrect x_getByObject request parameters)`))
}
if (result && result.msg.status === 'CLOSED') {
return cb(new Error(`Resource ${resourceId} was closed unexpectedly`))
return cb(new Error(`Resource ${resourceId} of type ${result.msg.type} was closed unexpectedly`))
}

@@ -612,10 +600,6 @@ cb(null, result)

getData: (poll, cb) => {
if (config.debug) {
console.log(`Getting records from resourceId: ${resourceId} using ${setMethods[poll.msg.type]}`)
}
instance.debug(`Getting records from resourceId: ${resourceId} of type ${poll.msg.type} using ${setMethods[poll.msg.type]}`)
if (!(poll.msg.size > 0)) {
if (config.debug) {
console.log(`No records found in SOAP response`)
}
instance.debug(`No records from resourceId: ${resourceId} of type ${poll.msg.type}`)
// poll.msg.size = 0, no need to go fetch result set

@@ -636,2 +620,4 @@ return setImmediate(cb.bind(null, null, []))

async.map(pagesArgs, (pagingArgs, cb) => {
instance.debug(`Fetching ${pagingArgs.size} records with offset ${pagingArgs.offset} from resourceId: ${resourceId} of type ${poll.msg.type}...`)
api[setMethodName]({

@@ -643,10 +629,9 @@ uuid, resourceId,

if (config.logPayload) {
console.log('payload outgoing', api.lastRequest)
instance.debug('payload outgoing', api.lastRequest)
}
if (err) {
if (config.debug) {
console.error('Error in getting resource set')
}
console.error('Error in getting resource set')
return cb(err)
}
instance.debug(`Received ${pagingArgs.size} records with offset ${pagingArgs.offset} from resourceId: ${resourceId} of type ${poll.msg.type}`)
// Turn the object with an array somewhere into an immediate array

@@ -659,3 +644,5 @@ cb(null, instance.normalizeOutput(setMethodName, result))

// callback with one big array of all records combined
cb(null, [].concat(...result))
result = [].concat(...result)
instance.debug(`Received ${result.length} records from resourceId: ${resourceId} of type ${poll.msg.type}`)
cb(null, result)
}

@@ -665,5 +652,3 @@ )

freeResource: (getData, cb) => {
if (config.debug) {
console.log(`Free resource with resourceId: ${resourceId}`)
}
instance.debug(`Free resource with resourceId: ${resourceId}`)
api.resource_free({ uuid, resourceId }, cb)

@@ -670,0 +655,0 @@ }

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

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

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