node-zendesk
Advanced tools
Comparing version 4.0.0 to 4.0.1
{ | ||
"name": "node-zendesk", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "description": "zendesk API client wrapper", |
@@ -85,2 +85,25 @@ const MODULES = { | ||
module.exports = {MODULES, ENDPOINTS}; | ||
const MODULE_BASE_PATHS = { | ||
core: './client/core/', | ||
helpcenter: './client/helpcenter/', | ||
nps: './client/nps/', | ||
services: './client/services/', | ||
voice: './client/voice/', | ||
}; | ||
const MODULE_MAP = {}; | ||
for (const apiType in MODULES) { | ||
if (Object.prototype.hasOwnProperty.call(MODULES, apiType)) { | ||
MODULE_MAP[apiType] = {}; | ||
for (const moduleName of MODULES[apiType]) { | ||
const modulePath = `${ | ||
MODULE_BASE_PATHS[apiType] | ||
}${moduleName.toLowerCase()}`; | ||
MODULE_MAP[apiType][moduleName.toLowerCase()] = require(modulePath); | ||
} | ||
} | ||
} | ||
module.exports = {MODULES, MODULE_BASE_PATHS, MODULE_MAP, ENDPOINTS}; |
// Index.js - node-zendesk client initialization | ||
'use strict'; | ||
const {MODULES, ENDPOINTS} = require('./constants'); | ||
const {MODULES, MODULE_MAP, ENDPOINTS} = require('./constants'); | ||
@@ -76,3 +76,3 @@ /** | ||
const moduleName = module.toLowerCase(); | ||
const ModuleClass = require(`./client/${type}/${moduleName}`)[module]; | ||
const ModuleClass = MODULE_MAP[type][moduleName][module]; | ||
this.client[moduleName] = new ModuleClass({ | ||
@@ -79,0 +79,0 @@ ...this.config, |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
217122
5714
1