Comparing version 0.2.31 to 0.2.34
@@ -16,6 +16,6 @@ var mongoose = require('mongoose'), | ||
FORM_SUBMISSION: "FormSubmission", | ||
GROUPS: "Groups" | ||
GROUPS: "Groups", | ||
APP_CONFIG: "AppConfig" | ||
}; | ||
return { | ||
@@ -245,2 +245,25 @@ "init": function (conn) { | ||
var appConfigSchema = new Schema({ | ||
"appId": {type: String, required: true, unique: true}, | ||
"client": { | ||
"sent_save_min": {type : Number, required: true}, | ||
"sent_save_max": {type : Number, required: true}, | ||
"targetWidth": {type : Number, required: true}, | ||
"targetHeight": {type : Number, required: true}, | ||
"quality": {type : Number, required: true}, | ||
"debug_mode": {type: Boolean, required: true, default: false}, | ||
"logger" : {type: Boolean, required: true, default: false}, | ||
"max_retries" : {type : Number, required: true}, | ||
"timeout" : {type : Number, required: true}, | ||
"log_line_limit": {type : Number, required: true}, | ||
"log_email": {type: String, required: true}, | ||
"config_admin_user": {type: Boolean, required: true, default: false} | ||
}, | ||
"cloud": { | ||
"logging": { | ||
"enabled": {type: Boolean, default: false} | ||
} | ||
} | ||
}, schemaOptions); | ||
var appThemesSchema = new Schema({ | ||
@@ -307,2 +330,3 @@ "appId": {type: String, required: true}, | ||
conn.model(MODELNAMES.GROUPS, groupsSchema); | ||
conn.model(MODELNAMES.APP_CONFIG, appConfigSchema); | ||
}, | ||
@@ -309,0 +333,0 @@ "get": function(conn, modelName){ |
113
lib/forms.js
@@ -8,2 +8,6 @@ var mongoose = require('mongoose'); | ||
var notification = require('./impl/notification.js'); | ||
var appConfig = require('./impl/appConfig.js')(); | ||
var logfns = require('../lib/common/logger.js'); | ||
var logger = logfns.getLogger(); | ||
var logWrapper = require('./common/logWrapper'); | ||
@@ -389,3 +393,8 @@ var forms = { | ||
if(err) return cb(err); | ||
return groups.getAllGroups(connections, options, cb); | ||
return groups.getAllGroups(connections, options, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
@@ -398,3 +407,8 @@ }, | ||
if(err) return cb(err); | ||
return groups.getGroup(connections, options, params, cb); | ||
return groups.getGroup(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
@@ -407,3 +421,8 @@ }, | ||
if(err) return cb(err); | ||
return groups.updateGroup(connections, options, params, cb); | ||
return groups.updateGroup(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
@@ -416,6 +435,85 @@ }, | ||
if(err) return cb(err); | ||
return groups.addAppToUsersGroups(connections,params.restrictToUser,params.appId,cb); | ||
return groups.addAppToUsersGroups(connections,params.restrictToUser,params.appId, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
}, | ||
createAppConfig: function (options, params, cb) { | ||
var self = this; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.createAppConfig(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
}, | ||
updateAppConfig: function (options, params, cb) { | ||
var self = this; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.updateAppConfig(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
}, | ||
getAppConfig: function (options, params, cb) { | ||
var self = this; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.getAppConfig(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
}, | ||
setAppConfig: function (options, params, cb) { | ||
var self = this; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.setAppConfig(connections, options, params, cb); | ||
}); | ||
}, | ||
deleteAppConfig: function (options, params, cb) { | ||
var self = this; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.deleteAppConfig(connections, options, params, function(err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result); | ||
}); | ||
}); | ||
}, | ||
getAppClientConfig: function (options, cb) { | ||
var self = this; | ||
var params = {appId: options.appId}; | ||
self.initConnection(options, function(err, connections) { | ||
if(err) return cb(err); | ||
return appConfig.getAppConfig(connections, options, params, function (err, result) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(undefined, result.client); | ||
}); | ||
}); | ||
}, | ||
createGroup: function (options, params, cb) { | ||
@@ -435,5 +533,12 @@ var self = this; | ||
}); | ||
}, | ||
setLogger: function (logger) { | ||
return logfns.setLogger(logger); | ||
} | ||
}; | ||
logWrapper.addLoggingToFunctions(forms, "forms.", ["setLogger"]); | ||
module.exports = forms; |
@@ -25,2 +25,3 @@ var fhamqpjs = require('fh-amqp-js'); | ||
var fh_amqp_vhost = process.env.FH_AMQP_VHOST; | ||
var fh_forms_notifications_enabled = process.env.FH_APPFORMS_NOTIFICATIONS_ENABLED; | ||
@@ -61,3 +62,3 @@ var fh_amqp_cluster_node; | ||
//once amqpManager is in place connections to the cluster should be handled by fh-amqp-js | ||
if ("true" === fh_amqp_enabled) { | ||
if ("true" === fh_amqp_enabled && "true" === fh_forms_notifications_enabled) { | ||
if (! amqpManager) { | ||
@@ -64,0 +65,0 @@ amqpManager = new fhamqpjs.AMQPManager(amqpConfig); |
{ | ||
"name": "fh-forms", | ||
"version": "0.2.31", | ||
"version": "0.2.34", | ||
"description": "Cloud Forms API for form submission", | ||
@@ -5,0 +5,0 @@ "main": "lib/forms.js", |
@@ -1,1 +0,1 @@ | ||
0.2.31-12 | ||
0.2.34-14 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219449
38
5959
10