Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22422630
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
28 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/app.js b/lib/app.js
index 42d3dad5..299157db 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -1,98 +1,97 @@
var path = require("path");
var ModuleManager = require("./module/module-manager.js");
var ConfigManager = require("./config/config-manager.js");
function SealiousApp(path_to_package_json, mode, layer_name){
this.mode = mode || "local";
this.layer_name = layer_name || null;
-
//ModuleManager = new ModuleManager();
//ConfigManager = new ConfigManager();
this.ChipManager = require("./chip-types/chip-manager");
if(this.mode=="local"){
this.dispatcher = require("../lib/dispatchers/local/dispatcher-local.js");
}else{
this.dispatcher = require("../lib/dispatchers/" + this.layer_name + "/dispatcher-" + this.layer_name + ".js");
}
this.init(require(path_to_package_json));
}
SealiousApp.prototype = new function(){
this.load_base_modules = function(){
ModuleManager.add_module(require.resolve("sealious-base-chips"))
}
this.config = function(config_object){
ConfigManager.set_config(config_object);
}
this.config_from_file = function(path_to_file){
this.config(require(path_to_file));
}
this.init = function(package_info){
this.load_base_modules();
this.load_all_modules(package_info);
}
this.load_all_modules = function(package_info){
var dependencies = package_info.dependencies;
for(var dependency_name in dependencies){
try{
var dependency_path = require.resolve(dependency_name);
}catch(e){
//in case the module is npm link-ed
var dependency_path = require.resolve(path.resolve(module.parent.parent.parent.filename, "../node_modules/"+dependency_name));
}
var dep_info = path.parse(dependency_path);
if(dep_info.name=="sealious-module" && dep_info.ext==".json"){
ModuleManager.add_module(dependency_path);
}
}
ModuleManager.initialize_all(this.dispatcher);
}
var which_chip_types_to_start_for_layer = {
db: ["datastore"],
biz: ["field_type", "resource_type", "service"],
web: ["field_type", "resource_type", "channel"]
}
function decide_chip_types_to_start(mode, layer_name){
if(mode=="local"){
return ["field_type", "resource_type", "service", "channel", "datastore"];
//}else if(!(layer_name)){
// throw new Sealious.Errors.ValidationError("Invalid layer name: " + layer_name); //~
}else{
return which_chip_types_to_start_for_layer[layer_name];
}
}
function getDispatcher(mode, layer_name){
if(mode=="local"){
var dispatcher_path = "./dispatchers/local/dispatcher-local.js";
}else{
var dispatcher_path = "./dispatchers/" + layer_name + "/dispatcher-" + layer_name + ".js";
}
console.log("dispatcher_path =", dispatcher_path);
return require(dispatcher_path);
}
this.start = function(){
this.dispatcher.init();
this.dispatcher.start();
var chip_types_to_start = decide_chip_types_to_start(this.mode, this.layer_name);
return ModuleManager.start(chip_types_to_start);
}
}
module.exports = SealiousApp;
\ No newline at end of file
diff --git a/lib/chip-types/resource-manager.js b/lib/chip-types/resource-manager.js
index 47333511..1bcdc0ce 100644
--- a/lib/chip-types/resource-manager.js
+++ b/lib/chip-types/resource-manager.js
@@ -1,222 +1,222 @@
var Promise = require("bluebird");
var ResourceRepresentation = require("./resource-representation.js");
var ChipManager = require("./chip-manager.js");
/**
* Manages resources in the database
* @class
*/
var ResourceManager = new function(){
this.create = function(dispatcher, type_name, body, owner, access_mode, access_mode_args){
if(arguments.length==3){
var owner=null;
var access_mode = "private";
var access_mode_args = [];
} else if(arguments.length==4){
var access_mode = "private";
} else if(arguments.length==5){
var access_mode = "private";
var access_mode_args = [];
} else if(arguments.length==6) {
} else {
throw new Sealious.Errors.ValidationError("Wrong amount of arguments: create_resource."); //~
}
if(!ChipManager.chip_is_registred("resource_type." + type_name)){
throw new Sealious.Errors.ValidationError("Unknown resource type: " + type_name); //~
}
var resource_type_object = ChipManager.get_chip("resource_type", type_name);
var encoded_body = null;
return new Promise(function(resolve, reject){
resource_type_object.validate_field_values(body)
.then(
function(){
return resource_type_object.encode_field_values(body);
}
).then(
function(response){
encoded_body = response;
- return dispatcher.metadata_increment_variable("first_free_id", dispatcher)
+ return dispatcher.services.metadata_manager.increment_variable("first_free_id", dispatcher)
}
).then(
function(newID) {
var resource_data = {
sealious_id: newID,
type: type_name,
body: encoded_body
};
resource_data.owner = owner;
resource_data.access_mode = access_mode;
resource_data.access_mode_args = access_mode_args;
dispatcher.datastore.insert("resources", resource_data, {}).then(function(data){
var database_entry = data[0];
var resource = new ResourceRepresentation(database_entry);
resolve(resource.getData());
});
}
).catch(function(e){
reject(e);
});
})
}
this.edit_resource_access_mode = function(dispatcher, resource_id, access_mode, access_mode_args){
if(arguments.length==3){
access_mode_args={};
}
return dispatcher.datastore.update("resources", {sealious_id: resource_id }, { $set: { access_mode:access_mode, access_mode_args: access_mode_args} });
}
this.get_resource_access_mode = function(dispatcher, resource_id){
resource_id = parseInt(resource_id);
return new Promise(function(resolve,reject){
dispatcher.datastore.find("resources", { sealious_id: resource_id }, {})
.then(function(documents){
var database_entry = documents[0];
var resource = new ResourceRepresentation(database_entry);
resolve(resource.get_access_mode());
});
});
}
this.delete = function(dispatcher, type_name, id){
if(!ChipManager.chip_is_registred("resource_type." + type_name)){
- throw new Sealious.Errors.ValidationError("Unknown resource type: " + type_name); //~
+ throw new Sealious.Errors.ValidationError("Unknown resource type: " + type_name);
}
return new Promise(function(resolve, reject){
dispatcher.datastore.delete("resources", {sealious_id: id, type: type_name}, {})
.then(function(data){
resolve();
}).catch(function(e){
reject(e);
});
})
}
/**
* Callback for idExists
* @callback ResourceManager~idExistsCallback
* @param {Boolean} exists - true if a resource with given id exists
*/
this.get_by_id = function(dispatcher, resource_id){
resource_id = parseInt(resource_id);
return new Promise(function(resolve,reject){
dispatcher.datastore.find("resources", { sealious_id: resource_id }, {})
.then(function(documents){
if (documents[0] === undefined) {
reject(new Sealious.Errors.NotFound("resource of id " + resource_id + " not found"));
} else {
var database_entry = documents[0];
var resource = new ResourceRepresentation(database_entry);
resolve(resource.getData());
}
});
});
}
this.list_by_type = function(dispatcher, type_name, params) {
if(arguments.length==2){
params = {};
}
return new Promise(function(resolve, reject){
if(!ChipManager.chip_is_registred("resource_type."+type_name)){
reject(new Sealious.Errors.ValidationError("resource type "+type_name+" does not exist"));
}else{
dispatcher.datastore.find("resources", { type: type_name }, {}, params).then(function(response) {
var ret = response.map(function(database_entry){
return new ResourceRepresentation(database_entry).getData();
})
resolve(ret);
})
}
})
}
this.find = function(dispatcher, field_values, type){
if(arguments.length==2){
type = null;
}
return new Promise(function(resolve, reject){
var query = {};
if(type){
query.type = type;
}
for(var field_name in field_values){
query["body." + field_name] = field_values[field_name];
}
dispatcher.datastore.find("resources", query)
.then(function(documents){
var parsed_documents = documents.map(function(document){return new ResourceRepresentation(document).getData()});
resolve(parsed_documents);
})
})
}
this.update_resource = function(dispatcher, resource_id, new_resource_data){
var query = {};
if(new_resource_data.hasOwnProperty("sealious_id")){
delete new_resource_data.sealious_id;
}
if(new_resource_data.hasOwnProperty("id")){
delete new_resource_data.id;
}
for(var field_name in new_resource_data){
query["body." + field_name] = new_resource_data[field_name];
}
return dispatcher.datastore.update("resources", {sealious_id: resource_id}, {$set: query});
}
this.search = function(dispatcher, type, field_name, query_string){
query = {body: {}};
query["body"][field_name] = new RegExp(query_string, "gi");
return new Promise(function(resolve, reject){
dispatcher.datastore.find("resources", query)
.then(function(documents){
var resource_representations = documents.map(function(document){return new ResourceRepresentation(document).getData()});
resolve(resource_representations);
})
})
}
this.search_by_mode = function(dispatcher, type, mode){
return new Promise(function(resolve, reject){
dispatcher.datastore.find("resources", {access_mode: mode, type: type}, {})
.then(function(documents){
var database_entry = documents;
var resource_representations = documents.map(function(document){
return new ResourceRepresentation(document).getData()
});
resolve(resource_representations);
});
});
}
this.get_resource_type_signature = function(dispatcher, type_name){
return new Promise(function(resolve, reject){
var resource_type_chip = ChipManager.get_chip("resource_type", type_name);
if(resource_type_chip){
resolve(resource_type_chip.get_signature());
}else{
reject(new Sealious.Errors.Error("ResourceManager tried to access chip type `" + type_name + "`, which does not exist."));
}
})
}
}
module.exports = ResourceManager;
diff --git a/lib/chip-types/resource-type-field.js b/lib/chip-types/resource-type-field.js
index 9e481fe4..714b6e51 100644
--- a/lib/chip-types/resource-type-field.js
+++ b/lib/chip-types/resource-type-field.js
@@ -1,85 +1,90 @@
var Promise = require("bluebird");
/**
* A field in a resource type
* @class
* @param {string} name
* @param {object} options
*/
function ResourceTypeField(declaration){
this.name = declaration.name;
this.type_name = declaration.type;
this.human_readable_name = declaration.human_readable_name || null;
var type_constructor = Sealious.ChipManager.get_chip("field_type", declaration.type);
this.type_parameters = declaration.params;
this.type = new type_constructor();
this.type.setParams(declaration.params);
this.required = declaration.required || false;
this.derived = declaration.derived || false;
}
ResourceTypeField.prototype = new function(){
/**
* Shorthand for ResourceTypeField.type.isProperValue
* @alias ResourceTypeField#isProperValue
* @param {object} value
* @return {Promise}
*/
this.isProperValue = function(value, dispatcher){
var that = this;
return new Promise(function(resolve, reject){
that.type.isProperValue(value, dispatcher).then(
resolve,
function(err){
+ /*
+ //older version, not compliant with #132
var new_error = {
field_name: that.name,
error_message: err
}
+ */
+ var new_error={};
+ new_error[that.name] = err;
reject(new_error);
}
);
})
}
/**
* Encodes a value for this field so it can be stored safey in database. Reverse of @link ResourceTypeField#decodeValue
* @alias ResourceTypeField#encodeValue
* @param {any} value
* @param {Boolean} as_hashmap
* @return {Promise}
*/
this.encode_value = function(value, as_hashmap){
var that = this;
return this.type.encode(value).then(function(encoded_value){
var ret_promise = new Promise(function(resolve, reject){
if(as_hashmap){
var ret = {};
ret[that.name] = encoded_value;
resolve(ret);
}else{
resolve(encoded_value);
}
})
return ret_promise;
});
}
/**
* @alias ResourceTypeField#decodeValue
* @todo Zaimplementować tę funkcję
*/
this.decodeValue = function(){
}
this.get_signature = function(){
var field_signature = {};
field_signature.name = this.name;
field_signature.type = this.type_name;
field_signature.required = this.required;
field_signature.human_readable_name = this.human_readable_name;
return field_signature;
}
}
module.exports = ResourceTypeField;
\ No newline at end of file
diff --git a/lib/chip-types/resource-type.js b/lib/chip-types/resource-type.js
index b656da74..fd342f99 100644
--- a/lib/chip-types/resource-type.js
+++ b/lib/chip-types/resource-type.js
@@ -1,89 +1,103 @@
var Promise = require("bluebird");
var ResourceTypeField = require("./resource-type-field.js");
var merge = require("merge");
var ResourceType = function(parent_module_path, name){
this.id = name;
this.longid = "resource_type" + name;
this.name = name;
this.fields = {};
Sealious.ChipManager.add_chip("resource_type", this.name, this, parent_module_path);
}
ResourceType.prototype = new function(){
this.add_field = function(field_declaration){
var field_object = new ResourceTypeField(field_declaration);
var field_name = field_object.name;
if(!this.fields[field_name]){
this.fields[field_name] = field_object;
}
}
this.add_fields = function(field_declarations_array){
for(var i in field_declarations_array){
var declaration = field_declarations_array[i];
this.add_field(declaration);
}
}
this.validate_field_values = function(values){
var that = this;
+ var validation_errors = {};
+ var found_errors = false;
return new Promise(function(resolve, reject){
for(var field_name in values){
//checking for unknown fields
if(that.fields[field_name]==undefined){
- throw new Sealious.Errors.ValidationError("unknown field: " + field_name); //~
+ //throw new Sealious.Errors.ValidationError("unknown field: " + field_name); //~
+ found_errors = true;
+ validation_errors[field_name] = "unknown_field";
}
}
for(var i in that.fields){
var field = that.fields[i];
if(field.required && !values[field.name]){
- reject(new Sealious.Errors.ValidationError("required field missing:" + field.name)) //~
- return;
+ //reject(new Sealious.Errors.ValidationError("required field missing:" + field.name)) //~
+ found_errors = true;
+ validation_errors[field.name] = "missing_value";
}
}
var promise_array = [];
for(var field_name in values){
- var temp_promise = that.fields[field_name].isProperValue(values[field_name]);
- promise_array.push(temp_promise);
+ if(validation_errors[field_name]===undefined){
+ var temp_promise = that.fields[field_name].isProperValue(values[field_name]);
+ promise_array.push(temp_promise);
+ }
}
+ var error_message = "There are problems with some of the provided values";//TODO: ładnie generować tekst podsumowujący problem z inputem
+
Promise.all(promise_array)
.then(function(result){
- resolve();
+ if(found_errors){
+ throw new Sealious.Errors.ValidationError(error_message, validation_errors);
+ }else{
+ resolve();
+ }
})
.catch(function(error){
- reject(error);
+ validation_errors = merge(validation_errors, error);
+ reject(new Sealious.Errors.ValidationError(error_message, validation_errors));
});
})
}
this.encode_field_values = function(body){
var promises = [];
for(var field_name in body){
var current_value = body[field_name];
promises.push(this.fields[field_name].encode_value(current_value, true));
}
return Promise.all(promises).then(function(responses){
return new Promise(function(resolve, reject){
resolve(merge.apply(merge, responses));
})
});
}
this.get_signature = function(){
var resource_type_signature = [];
for(var field_name in this.fields){
var field_signature = this.fields[field_name].get_signature();
resource_type_signature.push(field_signature);
}
return resource_type_signature;
}
}
ResourceType.is_a_constructor = false;
module.exports = ResourceType;
\ No newline at end of file
diff --git a/lib/dispatchers/biz/dispatcher-biz.js b/lib/dispatchers/biz/dispatcher-biz.js
index 5ec8e68c..6efc1c6c 100644
--- a/lib/dispatchers/biz/dispatcher-biz.js
+++ b/lib/dispatchers/biz/dispatcher-biz.js
@@ -1,26 +1,20 @@
-var MetadataManager = require("../../metadata-manager.js");
-
var DispatcherDistributed = require("../dispatcher-distributed.js");
var DispatcherDistributedBIZ = new DispatcherDistributed("biz");
-DispatcherDistributedBIZ.metadata_increment_variable = function() {
- //in local mode
- return MetadataManager.increment_variable.apply(MetadataManager, arguments);
-}
DispatcherDistributedBIZ.process_resource_manager_method = function(ResourceManager, method_name) {
return ResourceManager[method_name].bind(ResourceManager, this);
}
DispatcherDistributedBIZ.process_service_method = function(service, service_name, method_name) {
return service[method_name].bind(service, this);
}
DispatcherDistributedBIZ.process_datastore_method = function(datastore, method_name) {
return function(){
return this.call_over_socket("datastore."+ method_name, arguments);
}.bind(this);
}
module.exports = DispatcherDistributedBIZ;
diff --git a/lib/dispatchers/db/dispatcher-db.js b/lib/dispatchers/db/dispatcher-db.js
index 28c191e0..11b8dc40 100644
--- a/lib/dispatchers/db/dispatcher-db.js
+++ b/lib/dispatchers/db/dispatcher-db.js
@@ -1,27 +1,22 @@
-var MetadataManager = require("../../metadata-manager.js");
-
var DispatcherDistributed = require("../dispatcher-distributed.js");
var DispatcherDistributedDB = new DispatcherDistributed("db");
-DispatcherDistributedDB.metadata_increment_variable = function() {
- //...
-}
DispatcherDistributedDB.process_resource_manager_method = function(ResourceManager, method_name) {
return function(){
throw new Sealious.Errors.Error("DispatcherDistributedDB tried to call a ResourceManager method, which is not allowed.")
}
}
DispatcherDistributedDB.process_service_method = function(service, service_name, method_name) {
return function(){
throw new Sealious.Errors.Error("DispatcherDistributedDB tried to call a service method, which is not allowed.")
}
}
DispatcherDistributedDB.process_datastore_method = function(datastore, method_name) {
return datastore[method_name];
}
module.exports = DispatcherDistributedDB;
diff --git a/lib/dispatchers/local/dispatcher-local.js b/lib/dispatchers/local/dispatcher-local.js
index 0eaeb471..904307ca 100644
--- a/lib/dispatchers/local/dispatcher-local.js
+++ b/lib/dispatchers/local/dispatcher-local.js
@@ -1,25 +1,21 @@
var Promise = require("bluebird");
var Dispatcher = require("../dispatcher.js");
-var MetadataManager = require("../../metadata-manager.js");
var DispatcherLocal= Object.create(Dispatcher.prototype);
DispatcherLocal.process_service_method = function(service, service_name, method_name){
return service[method_name].bind(service, this);
}
DispatcherLocal.process_resource_manager_method = function(ResourceManager, method_name){
return ResourceManager[method_name].bind(ResourceManager, this);
}
DispatcherLocal.process_datastore_method = function(datastore_chip, method_name){
return datastore_chip[method_name].bind(datastore_chip);
}
-DispatcherLocal.metadata_increment_variable = function(){
- return MetadataManager.increment_variable.apply(MetadataManager, arguments);
-}
module.exports = DispatcherLocal;
diff --git a/lib/metadata-manager.js b/lib/metadata-manager.js
deleted file mode 100644
index aafbafc1..00000000
--- a/lib/metadata-manager.js
+++ /dev/null
@@ -1,70 +0,0 @@
-var Promise = require("bluebird");
-
-var MetadataManager = new function(){
-
- var that = this;
-
- this.get_value = function(key, dispatcher){
- return new Promise(function(resolve, reject){
- dispatcher.datastore.find("meta", { "key": key }, {}).then(function(response){
- if(response.length==0){
- resolve(undefined);
- }else{
- resolve(response[0].value);
- }
- });
- })
- }
-
- this.has_key = function(key, dispatcher){
- return new Promise(function(resolve, reject){
- dispatcher.datastore.find("meta", { key: key }, {}).then(function(response){
- if(response.length===0){
- resolve(false);
- }else{
- resolve(true);
- }
- });
- });
- }
-
- this.set_value = function(key, value, dispatcher){
- return new Promise(function(resolve, reject){
- that.has_key(key, dispatcher).then(function(has){
- function actual_set(){
- dispatcher.datastore.update("meta", { key: key }, {key:key, value: value}).then(function(response){
- if(response.length==0){
- resolve(false);
- }else{
- resolve(true);
- }
- });
- }
- if(!has){
- dispatcher.datastore.insert("meta", {key: key, value: value}, {}).then(function(data){
- actual_set();
- })
- }else{
- actual_set();
- }
- })
- })
- }
-
- this.increment_variable = function(key, dispatcher){
- return new Promise(function(resolve, reject){
- that.get_value(key, dispatcher).then(function(data){
- if(isNaN(data)){
- var new_id=0;
- }else{
- var new_id = data+1;
- }
- that.set_value(key, new_id, dispatcher).then(function(dataL){
- resolve(new_id);
- });
- });
- })
- }
-}
-
-module.exports = MetadataManager;
\ No newline at end of file
diff --git a/lib/response/error.js b/lib/response/error.js
index 2c950be2..38898e75 100644
--- a/lib/response/error.js
+++ b/lib/response/error.js
@@ -1,105 +1,115 @@
var Response = require("./response.js");
var SealiousErrors = {};
-SealiousErrors.Error = function(message, params){
+SealiousErrors.Error = function(message, params, data){
var ret = new Error(message);
params = params || {};
ret.is_sealious_error = true;
ret.status_message = message;
ret.is_error = true;
ret.is_user_fault = params.is_user_fault===undefined? false : params.is_user_fault;
ret.is_developer_fault = params.is_developer_fault===undefined? false : params.is_developer_fault;
ret.type = params.type===undefined? "error" : params.type;
ret.http_code = params.http_code===undefined? 500 : params.http_code;
-
- ret.toResponse = function(){
- return new Response({}, true, this.type, this.status_message);
- }
+ ret.data = data || {};
return ret;
}
-SealiousErrors.ValidationError = function(message){
- var err = new SealiousErrors.Error(message);
+/*
+SealiousErrors.Error.prototype = new function(){
+
+
+ this.is_error = true;
+
+
+ this.toString = function(){
+
+ }
+}
+*/
+
+SealiousErrors.ValidationError = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = true;
err.type="validation";
err.http_code = 403;
return err;
}
-SealiousErrors.ValueExists = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.ValueExists = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = true;
err.type="valueExists";
err.http_code = 409;
return err;
}
-SealiousErrors.InvalidCredentials = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.InvalidCredentials = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = true;
- err.type="validation";
+ err.type="authorization";
err.http_code = 401;
return err;
}
-SealiousErrors.NotFound = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.NotFound = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = true;
err.type="not_found";
err.http_code = 404;
return err;
}
-SealiousErrors.InternalConnectionError = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.InternalConnectionError = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = false;
err.type="internal_connection_error";
err.http_code = 500;
return err;
}
-SealiousErrors.DependencyError = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.DependencyError = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = false;
err.is_developer_fault = true;
err.type="dependency_error";
err.http_code = 500;
return err;
}
-SealiousErrors.UnauthorizedRequest = function(message){
- var err = new SealiousErrors.Error(message);
+SealiousErrors.UnauthorizedRequest = function(message, data){
+ var err = new SealiousErrors.Error(message, {}, data);
err.status_message = message;
err.is_user_fault = true;
err.type="unauthorized_request";
err.http_code = 401;
return err;
}
/*
process.on('uncaughtException', function (exception) {
switch(exception.code){
case "EACCES":
console.log("\nNo root access - closing!\n");
process.exit();
break;
case "EADDRINUSE":
console.log("\nPort 80 is already taken - closing!\n");
process.exit();
break;
default:
console.log(exception.stack);
throw exception;
break;
}
});
*/
module.exports = SealiousErrors;
\ No newline at end of file
diff --git a/lib/response/response.js b/lib/response/response.js
index 4c3355f7..f179702a 100644
--- a/lib/response/response.js
+++ b/lib/response/response.js
@@ -1,17 +1,17 @@
function Response(data, is_error, type, status_message){
this.status = is_error? "error" : "success";
this.type = type || "response";
this.status_message = status_message || ok;
this.data = data || {};
}
Response.fromError = function(sealious_error){
return {
- data: {},
+ data: sealious_error.data || {},
is_error: true,
type: sealious_error.type,
status_message: sealious_error.status_message
};
}
module.exports = Response;
\ No newline at end of file
diff --git a/package.json b/package.json
index ad8ecb7f..3e9bc9a0 100755
--- a/package.json
+++ b/package.json
@@ -1,45 +1,45 @@
{
"name": "sealious",
- "version": "0.2.5",
+ "version": "0.2.8",
"description": "",
"main": "./main.js",
"scripts": {
"test": "mocha ./tests/test.js && mocha ./tests/test.js -R travis-cov"
},
"repository": {
"type": "git",
"url": "https://github.com/Sealious/Sealious/"
},
"keywords": [
"sealious"
],
"author": "Kuba Orlik",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/Sealious/Sealious/issues"
},
"dependencies": {
"Set": "~0.4.1",
"bluebird": "~2.9.9",
"ip": "~0.3.2",
"merge": "^1.2.0",
"open": "0.0.5",
"socket.io": "~1.2.0",
"socket.io-client": "~1.2.0",
"winston": "^1.0.0"
},
"devDependencies": {
"blanket": "1.1.6",
"mocha": "*",
"should": "~4.4.0",
"travis-cov ": "*"
},
"config": {
"blanket": {
"pattern": "node_modules"
}
},
"peerDependencies": {
"sealious-base-chips": "^0.2.0"
}
}
diff --git a/sealious.sublime-project b/sealious.sublime-project
index ce005e9c..03d876d4 100644
--- a/sealious.sublime-project
+++ b/sealious.sublime-project
@@ -1,17 +1,14 @@
{
"folders":
[
{
- "follow_symlinks": true,
"path": "."
},
{
- "follow_symlinks": true,
- "path": "/home/kuba/Dropbox/Desktop/Sealious/sealious-example-app"
+ "path": "C:\\Github\\sealious-base-chips"
},
{
- "follow_symlinks": true,
- "path": "/home/kuba/Dropbox/Desktop/Sealious/sealious-base-chips"
+ "path": "C:\\Github\\sealious-example-app"
}
]
}
diff --git a/shell.js b/shell.js
index f9d7489f..17fb2b52 100755
--- a/shell.js
+++ b/shell.js
@@ -1,18 +1,17 @@
#!/usr/bin/env node
var SealiousCore = require("./lib/core.js");
var mode = "local";
var layer_name = null;
var index = 2;
var argument = process.argv[index];
if(argument && argument.slice(0,2)=="--"){
layer_name = argument.slice(2);
mode="distributed";
index++;
}
app_location = process.argv[index];
-
SealiousCore.start(mode, layer_name, app_location);
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 28, 03:25 (1 d, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1230181
Default Alt Text
(28 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline