New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cdrator

Package Overview
Dependencies
Maintainers
4
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdrator - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

.drone.yml

2

lib/cdrator.js

@@ -18,3 +18,3 @@ const invoker = require('./invoker')

) {
return this.send('CHANGE_NUMBER_PORTING_REQUEST', {
return this.send('SOAP_CHANGE_NUMBER_PORTING_REQUEST', {
subscriptionId: subscriptionId,

@@ -21,0 +21,0 @@ portDate: portDate

@@ -5,4 +5,3 @@ const changeCase = require('change-case')

function parseComplexValue (dto, parentKey) {
return dto
.value
return dto.value
.map(function (value) {

@@ -20,5 +19,3 @@ return parse(value, parentKey)

function parseArrayValue (dto) {
return dto
.value
.map(parseValue)
return dto.value.map(parseValue)
}

@@ -50,3 +47,4 @@

}
default: return null
default:
return null
}

@@ -62,3 +60,3 @@ }

const key = changeCase.camelCase(dto.key[0])
const key = changeCase.camelCase(dto.key[0]).replace(/_/g, '')
const result = {}

@@ -78,3 +76,3 @@ result[key] = value

if (typeof value === 'number') {
return (parseInt(value, 10) === value) ? 'longValueDTO' : 'doubleValueDTO'
return parseInt(value, 10) === value ? 'longValueDTO' : 'doubleValueDTO'
}

@@ -98,4 +96,4 @@ if (value instanceof Date) {

'@xsi:type': type,
'key': changeCase.constantCase(key),
'value': value
key: changeCase.constantCase(key),
value: value
}

@@ -102,0 +100,0 @@ }

@@ -9,5 +9,3 @@ const xmlBuilder = require('xmlbuilder')

changeCase.constantCase = function () {
return _cc
.apply(changeCase, arguments)
.replace(/(\w)_(\d)/, '$1$2')
return _cc.apply(changeCase, arguments).replace(/(\w)_(\d)/, '$1$2')
}

@@ -23,3 +21,3 @@

}
return val
return val !== undefined ? val : ''
}

@@ -53,3 +51,3 @@

const xsi = getXsi(value, index + 1, type)
const xmlns = (single) ? null : getXmlNs(index + 1)
const xmlns = single ? null : getXmlNs(index + 1)

@@ -64,45 +62,57 @@ let values

values = _.assign(xsi, xmlns, {
'key': changeCase.constantCase(key),
'value': secure(value)
key: changeCase.constantCase(key),
value: secure(value)
})
break
default: // object, Array, Date
default:
// object, Array, Date
if (value === null) {
return null
} else if (value instanceof Array) {
values = [xsi, xmlns, { key: changeCase.constantCase(key) }]
.concat(value.map(function (item) {
return buildValue(depluralize(key), item, index, true)
}))
values = { ...xsi,
...xmlns,
...{ key: changeCase.constantCase(key) },
value: value
.map(function (item) {
return buildValue(depluralize(key), item, index, true)
})
.filter(function (item) {
return item
})
}
} else if (value instanceof Date) {
values = [xsi, xmlns, { key: changeCase.constantCase(key) }]
.concat([{
value: secure(value)
}])
values = {
...xsi,
...xmlns,
...{ key: changeCase.constantCase(key) },
value: secure(value)
}
} else {
values = [xsi, xmlns, { key: changeCase.constantCase(key) }]
.concat(Object.keys(value).map(function (key) {
return buildValue(key, value[key], index, true)
}))
values = {
...xsi,
...xmlns,
...{ key: changeCase.constantCase(key) },
value: Object.keys(value)
.map(function (key) {
return buildValue(key, value[key], index, true)
})
.filter(function (item) {
return item
})
}
}
values = values.filter(function (item) { return item })
break
}
const result = {}
const resultKey = (single) ? 'value' : 'values'
result[resultKey] = values
return result
return values
}
function buildEnvelope (hookpointKey, args) {
const arg0 = [
{ '@xmlns': '' },
{ 'hookpointKey': { '#text': hookpointKey } }
].concat(
Object.keys(args).map(function (key, ix) {
const arg0 = {
'@xmlns': '',
hookpointKey: { '#text': hookpointKey },
values: Object.keys(args).map(function (key, ix) {
return buildValue(key, args[key], ix)
})
)
}

@@ -118,5 +128,5 @@ const xml = xmlBuilder

'@xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'executeMethod': {
executeMethod: {
'@xmlns': 'http://soap.CDRator.com/',
'arg0': arg0
arg0: arg0
}

@@ -137,7 +147,10 @@ }

if (response['S:Envelope']['S:Body'][0]['S:Fault']) {
callback(response['S:Envelope']['S:Body'][0]['S:Fault'][0]['faultstring'][0])
callback(
response['S:Envelope']['S:Body'][0]['S:Fault'][0]['faultstring'][0]
)
return
}
const rawResult = response['S:Envelope']['S:Body'][0]['ns2:executeMethodResponse'][0]['return'][0]
const rawResult =
response['S:Envelope']['S:Body'][0]['ns2:executeMethodResponse'][0]['return'][0]

@@ -159,5 +172,5 @@ if (!rawResult.values) {

const result = {
'errorCode': parseInt(rawResult.errorCode[0]),
'status': parseInt(rawResult.status[0]),
'values': values
errorCode: parseInt(rawResult.errorCode[0]),
status: parseInt(rawResult.status[0]),
values: values
}

@@ -164,0 +177,0 @@ callback(null, result)

{
"name": "cdrator",
"version": "1.2.1",
"version": "1.2.2",
"description": "Call CDRator SOAP WebServices using node.js",

@@ -9,3 +9,3 @@ "main": "lib/cdrator",

"lint": "eslint lib/**/*.js test/**/*.js",
"test": "nyc mocha test/**/*.js",
"test": "nyc mocha test/unit --recursive",
"format": "eslint lib/**/*.js test/**/*.js --fix",

@@ -54,8 +54,8 @@ "preversion": "npm run lint && npm test",

"dependencies": {
"change-case": "^2.3.0",
"lodash": "^3.9.3",
"moment": "^2.10.6",
"xml2js": "^0.4.9",
"xmlbuilder": "^2.6.4"
"change-case": "^3.1.0",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"xml2js": "^0.4.19",
"xmlbuilder": "^12.0.0"
}
}

@@ -41,3 +41,3 @@ const chai = require('chai')

it('calls send with the correct parameters', function () {
const hookpoint = 'CHANGE_NUMBER_PORTING_REQUEST'
const hookpoint = 'SOAP_CHANGE_NUMBER_PORTING_REQUEST'
const subscriptionId = '201305302012345678'

@@ -44,0 +44,0 @@ const portDate = new Date('2019-04-17 09:09:00')

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