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

cce-unified-config

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cce-unified-config - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

43

index.js

@@ -88,19 +88,36 @@ const axios = require('axios')

async list(type, q) {
// pass params from input
const params = {q}
// pass params from input, and set max results
const params = {
q,
resultsPerPage: 100,
startIndex: 0
}
try {
const response = await axios.get(this.url + type.toLowerCase(), {auth: this.auth, params})
let response = await axios.get(this.url + type.toLowerCase(), {auth: this.auth, params})
let totalResults = response.data.pageInfo.totalResults
// good response?
if (response.data[`${type}s`] && response.data[`${type}s`][0] && response.data[`${type}s`][0][`${type}`]) {
const data = response.data[`${type}s`][0][`${type}`]
// is response object an array or object?
if (Array.isArray(data)) {
// return array as-is
if (totalResults === 0) {
// no results
return []
} else {
// 1 or more results
let data = response.data[`${type}s`][0][`${type}`]
if (totalResults === 1) {
// return single result object as an array
return [data]
} else {
// more than 1 result
// check if there are more results to fetch
while (totalResults > params.startIndex + 100) {
// go get more results
// increase cursor
params.startIndex += 100
// fetch next data set
response = await axios.get(this.url + type.toLowerCase(), {auth: this.auth, params})
// append data
data = data.concat(response.data[`${type}s`][0][`${type}`])
}
// all done, return data array
return data
} else {
// return single result as array
return [data]
}
} else {
return []
}

@@ -107,0 +124,0 @@ } catch (e) {

{
"name": "cce-unified-config",
"version": "0.7.0",
"version": "0.7.1",
"description": "JavaScript library for Cisco Contact Center Enterprise APIs",

@@ -5,0 +5,0 @@ "main": "index.js",

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