Socket
Socket
Sign inDemoInstall

aios

Package Overview
Dependencies
5
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

67

datasource.js

@@ -5,3 +5,3 @@ "use strict";

const _ = require("lodash");
let dataSourceTypes = {};
const dataSourceTypes = {};
function DataSource(server, options) {

@@ -15,3 +15,2 @@ options = options || {};

exports.DataSource = DataSource;
;
// @ts-ignore

@@ -31,3 +30,3 @@ DataSource.get = function (type) {

DataSource.prototype.register = function (fn) {
let self = this;
const self = this;
if (fn && _.isFunction(fn)) {

@@ -40,3 +39,3 @@ this.server.command('ds', { method: 'register', spec: self.options }, function (err, response) {

else {
let response = this.server.command('ds', { method: 'register', spec: self.options }, fn);
const response = this.server.command('ds', { method: 'register', spec: self.options }, fn);
this.options = _.merge(this.options, response.spec);

@@ -56,3 +55,3 @@ return this;

};
let JdbcDataSource = function (server, options) {
const JdbcDataSource = function (server, options) {
options = options || {};

@@ -64,3 +63,3 @@ DataSource.call(this, server, options);

JdbcDataSource.prototype.execute = function (sql, fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -86,3 +85,3 @@ query: {

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
delete response.result['@t'];

@@ -96,3 +95,3 @@ return response.result;

JdbcDataSource.prototype.query = function (sql, fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -115,3 +114,3 @@ query: {

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
return response.result.data;

@@ -121,3 +120,3 @@ }

JdbcDataSource.prototype.update = function (sql, fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -143,3 +142,3 @@ query: {

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
delete response.result['@t'];

@@ -150,3 +149,3 @@ return response.result;

JdbcDataSource.prototype.executeBatch = function (sqls, fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -172,3 +171,3 @@ query: {

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
delete response.result['@t'];

@@ -178,17 +177,23 @@ return response.result;

};
let _processCatalogResults = function (res) {
let dbs = [];
res.result.catalogs.forEach(function (x) {
let db = { name: x, schemas: [] };
dbs.push(db);
res.result.schemas.forEach(function (s) {
if (s.catalog == x && s.schema) {
db.schemas.push(s.schema);
}
});
});
const _processCatalogResults = function (res) {
const dbs = [];
if (res && res.result) {
if (res.result.catalogs) {
res.result.catalogs.forEach(function (x) {
const db = { name: x, schemas: [] };
dbs.push(db);
if (res.result.schemas) {
res.result.schemas.forEach(function (s) {
if (s.catalog === x && s.schema) {
db.schemas.push(s.schema);
}
});
}
});
}
}
return dbs;
};
JdbcDataSource.prototype.listCatalogs = function (fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -201,3 +206,3 @@ query: {

this.server.command('ds.query', data, function (err, res) {
let dbs = _processCatalogResults(res);
const dbs = _processCatalogResults(res);
fn(err, dbs);

@@ -207,3 +212,3 @@ });

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
return _processCatalogResults(response);

@@ -216,3 +221,3 @@ }

JdbcDataSource.prototype.listTables = function (selection, fn) {
let data = {
const data = {
dsn: this.getName(),

@@ -224,4 +229,4 @@ query: {

if (_.isString(selection)) {
let split = selection.split('.');
if (split.length == 2) {
const split = selection.split('.');
if (split.length === 2) {
data.query.catalog = split[1];

@@ -251,3 +256,3 @@ data.query.schema = split[0];

else {
let response = this.server.command('ds.query', data, fn);
const response = this.server.command('ds.query', data, fn);
return response.result.tables;

@@ -254,0 +259,0 @@ }

{
"name": "aios",
"version": "1.0.0",
"version": "1.0.1",
"description": "Socket client for Aios server",

@@ -32,3 +32,3 @@ "main": "server.js",

"bson": "^4.0.4",
"lodash": "^4.17.15"
"lodash": "^4.17.19"
},

@@ -39,3 +39,3 @@ "devDependencies": {

"@types/lodash": "^4.14.156",
"codecov": "^3.7.0",
"codecov": "^3.7.1",
"codelyzer": "^5.2.0",

@@ -42,0 +42,0 @@ "del": "^5.1.0",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc