Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zcrmsdk

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zcrmsdk - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

.DS_Store

167

lib/js/util.js

@@ -56,113 +56,92 @@

var crmclient = require('./ZCRMRestClient');
var httpclient = require('request');
var OAuth = require('./OAuth');
var mysql_util = require(crmclient.getMySQLModule());
var qs = require('querystring');
mysql_util.getOAuthTokens(crmclient.getUserIdentifier()).then(function(result_obj){
var access_token = result_obj[0].accesstoken;
var baseUrl = "https://"+crmclient.getAPIURL()+"/crm/"+crmclient.getVersion() +"/"+ request.url;
if (request.params)
{
baseUrl = baseUrl + '?' + request.params;
}
var crmclient = require('./ZCRMRestClient');
var httpclient = require('request');
var OAuth = require('./OAuth');
var mysql_util = require(crmclient.getMySQLModule());
var qs = require('querystring');
mysql_util.getOAuthTokens(crmclient.getUserIdentifier()).then(function(result_obj){
var access_token = result_obj[0].accesstoken;
var baseUrl = "https://"+crmclient.getAPIURL()+"/crm/"+crmclient.getVersion() +"/"+ request.url;
if (request.params)
{
baseUrl = baseUrl + '?' + request.params;
}
var api_headers = {};
var encoding ="utf8";
var req_body = null;
var formData = null;
var api_headers = {};
var encoding ="utf8";
var req_body = null;
var formData = null;
if (request.download_file){
encoding = "binary";//No I18N
}
if (request.download_file){
encoding = "binary";//No I18N
}
var form_Data = null;
var form_Data = null;
if (request.x_file_content) {
var FormData = require('form-data');
form_Data = new FormData();
form_Data.append('file', request.x_file_content);//No I18N
req_body = form_Data;
api_headers = form_Data.getHeaders();
}
else{
req_body = request.body || null;
}
if(request.headers){
var header_keys = Object.keys(request.headers);
for(i in header_keys){
api_headers[header_keys[i]] = request.headers[header_keys[i]];
if (request.x_file_content) {
var FormData = require('form-data');
form_Data = new FormData();
form_Data.append('file', request.x_file_content);//No I18N
req_body = form_Data;
api_headers = form_Data.getHeaders();
}
}
api_headers.Authorization = 'Zoho-oauthtoken '+access_token;
api_headers["User-Agent"] = 'Zoho CRM Node SDK';
else{
req_body = request.body || null;
}
httpclient({
uri : baseUrl,
method : request.type,
headers : api_headers,
body:req_body,
encoding: encoding
},function(error,response,body){
if(error){
resolve(error);
if(request.headers){
var header_keys = Object.keys(request.headers);
for(i in header_keys){
api_headers[header_keys[i]] = request.headers[header_keys[i]];
}
}
if(response.statusCode == 204){
api_headers.Authorization = 'Zoho-oauthtoken '+access_token;
api_headers["User-Agent"] = 'Zoho CRM Node SDK';
httpclient({
var respObj = {
"message" : "no data", //No I18N
"status_code" : "204" //No I18N
}
resolve(JSON.stringify(respObj));
uri : baseUrl,
method : request.type,
headers : api_headers,
body:req_body,
encoding: encoding
},function(error,response,body){
}else{
if(error){
resolve(error);
}
else if(response.statusCode == 204){
var respObj = {
"message" : "no data", //No I18N
"status_code" : "204" //No I18N
}
resolve(JSON.stringify(respObj));
if (request.download_file){
}else{
if (request.download_file){
var filename;
var disposition =response.headers["content-disposition"];//No I18N
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
var matches = filenameRegex.exec(disposition);
if (matches != null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');
filename = filename.replace('UTF-8','');
}
var filename;
var disposition =response.headers["content-disposition"];//No I18N
if (disposition && disposition.indexOf('attachment') !== -1) {
var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
var matches = filenameRegex.exec(disposition);
if (matches != null && matches[1]) {
filename = matches[1].replace(/['"]/g, '');
filename = filename.replace('UTF-8','');
}
response.filename = filename;
resolve(response);
}
else{
resolve(response);
}
}
});
response.filename = filename;
resolve(response);
}
else{
resolve(response);
}
}
});
})
})
})
}

@@ -169,0 +148,0 @@

@@ -76,3 +76,8 @@

var mandatory_values = ['client_id','client_secret','redirect_uri']
mandatory_values.forEach(function (key) {
if (!configJSON[key]){
throw new Error('Missing configuration for Zoho OAuth service: '+ key);
}
})
var client_id = configJSON.client_id;

@@ -82,6 +87,9 @@ var client_secret = configJSON.client_secret;

var iam_url = configJSON.iamurl?configJSON.iamurl:iamurl;
mysql_module = configJSON.mysql_module?configJSON.mysql_module:mysql_module;
baseURL = configJSON.baseurl?configJSON.baseurl:baseURL;
var useridentifier = configJSON.user_identifier?configJSON.user_identifier:default_user_identifier;
mysql_username = configJSON.mysql_username?configJSON.mysql_username:mysql_username;
mysql_password = configJSON.mysql_password?configJSON.mysql_password:mysql_password;
baseURL = configJSON.base_url?configJSON.base_url:baseURL;
version = configJSON.version?configJSON.version:version;
mysql_module = configJSON.tokenmanagement?configJSON.tokenmanagement:mysql_module;

@@ -91,3 +99,4 @@ ZCRMRestClient.setClientId(client_id);

ZCRMRestClient.setRedirectURL(redirect_url);
ZCRMRestClient.setIAMUrl(iam_url);
ZCRMRestClient.setUserIdentifier(useridentifier);

@@ -94,0 +103,0 @@ }

{
"name": "zcrmsdk",
"version": "0.0.16",
"version": "0.0.17",
"description": "Node SDK for Zoho CRM",

@@ -8,6 +8,6 @@ "main": "lib/js/ZCRMRestClient",

"fs": "0.0.1-security",
"mysql": "^2.17.1",
"mysql": "^2.18.1",
"properties-reader": "0.0.16",
"querystring": "^0.2.0",
"request": "^2.88.0"
"request": "^2.88.2"
},

@@ -14,0 +14,0 @@ "keywords": [

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