diff --git a/Client/MultiProject.js b/Client/MultiProject.js index ba4ce0182..954798729 100644 --- a/Client/MultiProject.js +++ b/Client/MultiProject.js @@ -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] diff --git a/Client/client.js b/Client/client.js index 46037d580..ddf179ff6 100644 --- a/Client/client.js +++ b/Client/client.js @@ -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. */ diff --git a/Client/githubServer.js b/Client/githubServer.js index 2b2c68345..ea8569e6d 100644 --- a/Client/githubServer.js +++ b/Client/githubServer.js @@ -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 diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 7d89e508e..f18721f62 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -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 diff --git a/Network/Bootstrap.js b/Network/Bootstrap.js new file mode 100644 index 000000000..14b195158 --- /dev/null +++ b/Network/Bootstrap.js @@ -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() { + + } + + +} \ No newline at end of file diff --git a/Network/SocialGraphNetwokNode.js b/Network/SocialGraphNetwokNode.js index c0fdd7e10..a886b34e9 100644 --- a/Network/SocialGraphNetwokNode.js +++ b/Network/SocialGraphNetwokNode.js @@ -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() \ No newline at end of file diff --git a/Projects/Foundations/CL/Utilities/Plugins.js b/Projects/Foundations/SA/Utilities/Plugins.js similarity index 100% rename from Projects/Foundations/CL/Utilities/Plugins.js rename to Projects/Foundations/SA/Utilities/Plugins.js diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index ce4508dd5..41d97c731 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -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" ] } -] +] \ No newline at end of file