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

coaclient

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coaclient - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

34

coaclient.js

@@ -31,6 +31,11 @@ const csvWriter = require('csv-write-stream');

};
exports.getClient = function(clientName) {
return getClientFromCSVFile(clientName);
return getClientFromCSVFileByNameOrId(clientName);
};
exports.getListOfClients = function() {
return getAllClientFromCSVFile();
};
exports.addClient = function(clientName, clientId, clientSecret, scope) {

@@ -61,4 +66,3 @@ saveClientToCSVFile(clientName, clientId, clientSecret, scope);

function getClientFromCSVFile(clientName) {
var clientObj = {};
function getClientFromCSVFileByNameOrId(clientIdentifier) {
let inputStream = fs.createReadStream(configFilePath, 'utf8');

@@ -68,11 +72,15 @@ inputStream

.on('data', function (row) {
console.log('A row arrived: ', row);
if (row.name === clientIdentifier || row.clientId === clientIdentifier) {
return JSON.stringify(createClientConfig(row));
}
})
.on('end', function (data) {
console.log('No more rows!');
console.log('No more data in file.');
});
console.log("Client config " + clientIdentifier + " not found.");
return JSON.stringify({});
}
function getAllClientFromCSVFile() {
var listOfClientConfig = [];
let listOfClientConfig = [];
let inputStream = fs.createReadStream(configFilePath, 'utf8');

@@ -82,8 +90,16 @@ inputStream

.on('data', function (row) {
console.log('A row arrived: ', row);
listOfClientConfig.push(createClientConfig(row));
})
.on('end', function (data) {
console.log('No more rows!');
console.log('No more data in file.');
});
return JSON.stringify(listOfClientConfig);
}
function createClientConfig(rowElement) {
return new ClientConfig(
rowElement.name,
rowElement.clientId,
rowElement.clientSecret,
rowElement.scope)
}
{
"name": "coaclient",
"version": "1.0.12",
"version": "1.0.13",
"description": "Custom Node.js library for manage CourseraOAuth2 API tokens",

@@ -5,0 +5,0 @@ "main": "coaclient",

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