Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995657
core.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
core.js
View Options
var
Sealious
=
require
(
"./main.js"
);
var
path
=
require
(
"path"
);
var
http
=
require
(
"http"
);
var
ConfigManager
=
require
(
"./config/config-manager.js"
);
var
SealiousCore
=
new
function
(){
this
.
check_version
=
function
(
package_info
){
var
pkg
=
require
(
"../package.json"
)
var
pkg_split
=
pkg
.
version
.
split
(
"."
);
var
version
=
pkg_split
[
0
]
+
"."
+
pkg_split
[
1
];
var
url
=
"http://registry.npmjs.org/sealious/"
+
version
;
var
check_request
=
http
.
get
(
url
,
function
(
res
){
res
.
setEncoding
(
'utf8'
);
var
body
=
""
;
res
.
on
(
'data'
,
function
(
chunk
){
body
+=
chunk
.
toString
();
});
res
.
on
(
'end'
,
function
(){
try
{
var
sealious_npm
=
JSON
.
parse
(
body
);
}
catch
(
error
)
{
Sealious
.
Logger
.
error
(
new
Sealious
.
Errors
.
Error
(
"Could not fetch update information from NPM registry."
));
}
var
sealious_npm_array
=
sealious_npm
.
version
.
split
(
"."
);
if
((
sealious_npm
.
version
!==
pkg
.
version
)
&&
(
parseInt
(
sealious_npm_array
[
2
])
>
parseInt
(
pkg_split
[
2
])))
{
Sealious
.
Logger
.
warning
(
"Sealious@"
+
pkg
.
version
+
" - update available. Run `npm install sealious@"
+
sealious_npm
.
version
+
"` to update."
);
}
else
{
Sealious
.
Logger
.
info
(
"Sealious@"
+
pkg
.
version
+
" is up-to-date."
);
}
});
});
check_request
.
on
(
'error'
,
function
(
err
){
Sealious
.
Logger
.
warning
(
"No network connection available! Unable to fetch information about updates to Sealious."
);
});
}
this
.
which_chip_types_to_start_for_layer
=
{
db
:
[
"datastore"
],
biz
:
[
"field_type"
,
"resource_type"
,
"service"
],
web
:
[
"field_type"
,
"resource_type"
,
"channel"
]
}
this
.
config
=
function
(
config_object
){
ConfigManager
.
set_config
(
config_object
);
}
this
.
decide_chip_types_to_start
=
function
(
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
];
}
}
this
.
get_dispatcher
=
function
(
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"
;
}
return
require
(
dispatcher_path
);
}
}
module
.
exports
=
SealiousCore
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 12:42 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556899
Default Alt Text
core.js (2 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment