Introduction of SA as a namespace for modules shared between different system components
This commit is contained in:
1 parent
30759dc934
commit
6504f47b6f
8 files changed
+77
-41
No files matched your search
+17
-20
@@ -6,7 +6,7 @@ exports.newMultiProject = function () {
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize() {
|
||||
function initialize(rootObject, rootObjectName) {
|
||||
/*
|
||||
First thing is to load the project schema file.
|
||||
*/
|
||||
@@ -16,27 +16,24 @@ exports.newMultiProject = function () {
|
||||
Here we will setup the CL object, with all the
|
||||
projects and modules that will have inside.
|
||||
*/
|
||||
CL.projects = {}
|
||||
rootObject.projects = {}
|
||||
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let projectDefinition = PROJECTS_SCHEMA[i]
|
||||
global.CL.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = global.CL.projects[projectDefinition.propertyName]
|
||||
global[rootObjectName].projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = global[rootObjectName].projects[projectDefinition.propertyName]
|
||||
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.taskModules = {}
|
||||
projectInstance.processModules = {}
|
||||
projectInstance.botModules = {}
|
||||
|
||||
if (projectDefinition.CL === undefined) { continue }
|
||||
if (projectDefinition[rootObjectName] === undefined) { continue }
|
||||
|
||||
/* Set up Utilities of this Project */
|
||||
if (projectDefinition.CL.utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition.CL.utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition.CL.utilities[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + 'CL' + '/' + 'Utilities' + '/' + utilityDefinition.fileName
|
||||
if (projectDefinition[rootObjectName].utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition[rootObjectName].utilities[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + rootObjectName + '/' + 'Utilities' + '/' + utilityDefinition.fileName
|
||||
|
||||
let requiredObject = require(path)
|
||||
let requiredFunction = requiredObject[utilityDefinition.functionName]
|
||||
@@ -45,10 +42,10 @@ exports.newMultiProject = function () {
|
||||
}
|
||||
|
||||
/* Set up Globals of this Project */
|
||||
if (projectDefinition.CL.globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition.CL.globals.length; j++) {
|
||||
let globalDefinition = projectDefinition.CL.globals[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + 'CL' + '/' + 'Globals' + '/' + globalDefinition.fileName
|
||||
if (projectDefinition[rootObjectName].globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].globals.length; j++) {
|
||||
let globalDefinition = projectDefinition[rootObjectName].globals[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + rootObjectName + '/' + 'Globals' + '/' + globalDefinition.fileName
|
||||
|
||||
let requiredObject = require(path)
|
||||
let requiredFunction = requiredObject[globalDefinition.functionName]
|
||||
@@ -57,10 +54,10 @@ exports.newMultiProject = function () {
|
||||
}
|
||||
|
||||
/* Set up Function Libraries of this Project */
|
||||
if (projectDefinition.CL.functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition.CL.functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition.CL.functionLibraries[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + 'CL' + '/' + 'Function-Libraries' + '/' + functionLibraryDefinition.fileName
|
||||
if (projectDefinition[rootObjectName].functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].functionLibraries[j]
|
||||
let path = global.env.PATH_TO_PROJECTS_REQUIRED + '/' + projectDefinition.name + '/' + rootObjectName + '/' + 'Function-Libraries' + '/' + functionLibraryDefinition.fileName
|
||||
|
||||
let requiredObject = require(path)
|
||||
let requiredFunction = requiredObject[functionLibraryDefinition.functionName]
|
||||
|
||||
+11
-2
@@ -54,8 +54,16 @@ global.CUSTOM_FAIL_RESPONSE = {
|
||||
message: 'Custom Message'
|
||||
}
|
||||
|
||||
/* The CL object is accesible everywhere at the Superalgos Client */
|
||||
/*
|
||||
The CL object is accesible everywhere at the Superalgos Client.
|
||||
It provides access to all modules built for this Client.
|
||||
*/
|
||||
global.CL = {}
|
||||
/*
|
||||
The SA object is accesible everywhere at the Superalgos Client.
|
||||
It provides access to all modules built Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
|
||||
/* Servers */
|
||||
let WEB_SERVER = require('./webServer.js')
|
||||
@@ -79,7 +87,8 @@ try {
|
||||
*/
|
||||
let MULTI_PROJECT = require('./MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize()
|
||||
MULTI_PROJECT_MODULE.initialize(CL, 'CL')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
|
||||
@@ -472,14 +472,14 @@ exports.newGithubServer = function newGithubServer() {
|
||||
unless the existing one belongs to the same Github username.
|
||||
*/
|
||||
let userProfileIdMap = new Map()
|
||||
let pluginFileNames = await CL.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
|
||||
let pluginFileContent = await CL.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
let pluginFileContent = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
pluginFileName
|
||||
@@ -522,13 +522,13 @@ exports.newGithubServer = function newGithubServer() {
|
||||
unless the existing one belongs to the same Github username.
|
||||
*/
|
||||
let userProfileIdMap = new Map()
|
||||
let pluginFileNames = await CL.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
let pluginFileContent = await CL.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
let pluginFileContent = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
'Governance',
|
||||
'User-Profiles',
|
||||
pluginFileName
|
||||
|
||||
@@ -1350,7 +1350,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let project = unescape(requestParameters[2])
|
||||
let folder = unescape(requestParameters[3])
|
||||
|
||||
let response = await CL.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
let response = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
project,
|
||||
folder
|
||||
)
|
||||
@@ -1384,7 +1384,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
let folder = unescape(requestParameters[3])
|
||||
let fileName = unescape(requestParameters[4])
|
||||
|
||||
let response = await CL.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
let response = await SA.projects.foundations.utilities.plugins.getPluginFileContent(
|
||||
project,
|
||||
folder,
|
||||
fileName
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
exports.newBootstrap = function newBootstrap() {
|
||||
/*
|
||||
This module helps the Network Node to bootstrap, by
|
||||
loading all the services and data that needs to start
|
||||
operating.
|
||||
*/
|
||||
let thisObject = {
|
||||
/* Framework Functions */
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ This module is the starting point of the Social Graph Network Node.
|
||||
This type of node is responsible for mantaining the whole Social Graph
|
||||
or relationships between User and Bot profiles and also between their posts.
|
||||
*/
|
||||
|
||||
global.NT = {
|
||||
memory: {
|
||||
maps: {
|
||||
@@ -24,6 +23,7 @@ global.NT = {
|
||||
}
|
||||
},
|
||||
modules: {
|
||||
BOOTSTRAP: require('./Bootstrap.js'),
|
||||
EVENT: require('./Event.js'),
|
||||
USER_PROFILE: require('./UserProfile.js'),
|
||||
BOT_PROFILE: require('./BotProfile.js'),
|
||||
@@ -54,3 +54,5 @@ global.NT = {
|
||||
}
|
||||
}
|
||||
|
||||
let bootstrapProcess = NT.modules.BOOTSTRAP.newBootstrap()
|
||||
bootstrapProcess.initialize()
|
||||
File renamed without changes.
@@ -884,7 +884,11 @@
|
||||
"propertyName": "webAccess",
|
||||
"functionName": "newFoundationsUtilitiesWebAccess",
|
||||
"fileName": "WebAccess.js"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
"SA": {
|
||||
"utilities": [
|
||||
{
|
||||
"name": "Plugins",
|
||||
"propertyName": "plugins",
|
||||
@@ -984,18 +988,18 @@
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
},
|
||||
{
|
||||
"name": "TensorFlow Models Manager",
|
||||
"propertyName": "tensorFlowModelsManager",
|
||||
"functionName": "newTensorFlowModelsManager",
|
||||
"fileName": "TensorFlowModelsManager.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
"name": "TensorFlow Models Manager",
|
||||
"propertyName": "tensorFlowModelsManager",
|
||||
"functionName": "newTensorFlowModelsManager",
|
||||
"fileName": "TensorFlowModelsManager.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
},
|
||||
{
|
||||
"name": "ML Data Manager",
|
||||
"propertyName": "mlData",
|
||||
"functionName": "newMLDataObj",
|
||||
"fileName": "MLDataManager.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
"name": "ML Data Manager",
|
||||
"propertyName": "mlData",
|
||||
"functionName": "newMLDataObj",
|
||||
"fileName": "MLDataManager.js",
|
||||
"folderName": "Learning-Bot/Low-Frequency-Learning"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1264,4 +1268,4 @@
|
||||
"Positions"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
Reference in new issue
Block a user