diff --git a/Network/SocialGraphNetwokNode.js b/Network/SocialGraphNetwokNode.js index d35c0d9bd..fc8c55ca1 100644 --- a/Network/SocialGraphNetwokNode.js +++ b/Network/SocialGraphNetwokNode.js @@ -10,25 +10,7 @@ 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 = { - modules: { - BOOTSTRAP: require('./Bootstrap.js'), - USER_PROFILE: require('./UserProfile.js'), - BOT_PROFILE: require('./BotProfile.js'), - POST: require('./Post.js'), - QUERY: require('./Query.js'), - QUERY_USER_PROFILE_STATS: require('./Queries/UserProfileStats.js'), - QUERY_BOT_PROFILE_STATS: require('./Queries/BotProfileStats.js'), - QUERY_PROFILE_POSTS: require('./Queries/ProfilePosts.js'), - QUERY_PROFILE_FOLLOWERS: require('./Queries/ProfileFollowers.js'), - QUERY_PROFILE_FOLLOWING: require('./Queries/ProfileFollowing.js'), - QUERY_POST_REPLIES: require('./Queries/PostReplies.js'), - QUERY_EVENTS: require('./Queries/Events.js') - }, - utilities: { - queriesValidations: require('./Utilities/QueriesValidations.js').newQueriesValidations() - } -} + /* The NT object is accesible everywhere at the Superalgos Network. It provides access to all modules built for this Network. diff --git a/Network/clientsInterface.js b/Network/clientsInterface.js index 482da953f..5fdbf56aa 100644 --- a/Network/clientsInterface.js +++ b/Network/clientsInterface.js @@ -80,7 +80,7 @@ exports.newClientInterface = function newClientInterface() { */ let queryReceived = JSON.parse(queryMessage) - let query = NT.modules.QUERY.newQuery() + let query = NT.modules.queriesQuery.newNetworkModulesQuery() query.initialize(queryReceived) return query.execute() } diff --git a/Network/Bootstrap.js b/Projects/Network/NT/Modules/Bootstrap.js similarity index 100% rename from Network/Bootstrap.js rename to Projects/Network/NT/Modules/Bootstrap.js diff --git a/Network/Queries/BotProfileStats.js b/Projects/Network/NT/Modules/Queries/BotProfileStats.js similarity index 93% rename from Network/Queries/BotProfileStats.js rename to Projects/Network/NT/Modules/Queries/BotProfileStats.js index 9e157202f..87b7b3708 100644 --- a/Network/Queries/BotProfileStats.js +++ b/Projects/Network/NT/Modules/Queries/BotProfileStats.js @@ -1,4 +1,4 @@ -exports.newBotProfileStats = function newBotProfileStats() { +exports.newNetworkModulesQueriesBotProfileStats = function newNetworkModulesQueriesBotProfileStats() { let thisObject = { profile: undefined, diff --git a/Network/Queries/Events.js b/Projects/Network/NT/Modules/Queries/Events.js similarity index 95% rename from Network/Queries/Events.js rename to Projects/Network/NT/Modules/Queries/Events.js index 79fbb6bba..f36a6d121 100644 --- a/Network/Queries/Events.js +++ b/Projects/Network/NT/Modules/Queries/Events.js @@ -1,4 +1,4 @@ -exports.newEvents = function newEvents() { +exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents() { /* This is the query executed to fill the timeline of a certain User or Bot Profile. @@ -217,28 +217,28 @@ exports.newEvents = function newEvents() { } if (emitterUserProfile !== undefined) { - let query = NT.modules.QUERY_USER_PROFILE_STATS.newUserProfileStats() + let query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() query.initialize({ targetUserProfileId: event.emitterUserProfileId }) eventResponse.emitterUserProfile = query.execute() query.finalize() } if (targetUserProfile !== undefined) { - let query = NT.modules.QUERY_USER_PROFILE_STATS.newUserProfileStats() + let query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() query.initialize({ targetUserProfileId: event.targetUserProfileId }) eventResponse.targetUserProfile = query.execute() query.finalize() } if (emitterBotProfile !== undefined) { - let query = NT.modules.QUERY_BOT_PROFILE_STATS.newBotProfileStats() + let query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() query.initialize({ targetUserProfileId: event.emitterUserProfileId, targetBotProfileId: emitterBotProfileId }) eventResponse.emitterBotProfile = query.execute() query.finalize() } if (targetBotProfile !== undefined) { - let query = NT.modules.QUERY_BOT_PROFILE_STATS.newBotProfileStats() + let query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() query.initialize({ targetUserProfileId: event.targetUserProfileId, targetBotProfileId: targetBotProfileId }) eventResponse.targetBotProfile = query.execute() query.finalize() diff --git a/Network/Queries/PostReplies.js b/Projects/Network/NT/Modules/Queries/PostReplies.js similarity index 96% rename from Network/Queries/PostReplies.js rename to Projects/Network/NT/Modules/Queries/PostReplies.js index a3d0409ae..cb0a36882 100644 --- a/Network/Queries/PostReplies.js +++ b/Projects/Network/NT/Modules/Queries/PostReplies.js @@ -1,4 +1,4 @@ -exports.newPostReplies = function newPostReplies() { +exports.newNetworkModulesQueriesPostReplies = function newNetworkModulesQueriesPostReplies() { /* Each Post regardless if it is authored by a User or Bot Profile, can have replies. This query is designed for Network Clients to diff --git a/Network/Queries/ProfileFollowers.js b/Projects/Network/NT/Modules/Queries/ProfileFollowers.js similarity index 94% rename from Network/Queries/ProfileFollowers.js rename to Projects/Network/NT/Modules/Queries/ProfileFollowers.js index 8acf26762..45c877e46 100644 --- a/Network/Queries/ProfileFollowers.js +++ b/Projects/Network/NT/Modules/Queries/ProfileFollowers.js @@ -1,4 +1,4 @@ -exports.newProfileFollowers = function newProfileFollowers() { +exports.newNetworkModulesQueriesProfileFollowers = function newNetworkModulesQueriesProfileFollowers() { /* This module represents the query that allows a Network Client to know all the User or Bot profiles that are following a certain User or Bot profile. diff --git a/Network/Queries/ProfileFollowing.js b/Projects/Network/NT/Modules/Queries/ProfileFollowing.js similarity index 94% rename from Network/Queries/ProfileFollowing.js rename to Projects/Network/NT/Modules/Queries/ProfileFollowing.js index 9f544b53f..ae0dd7e1c 100644 --- a/Network/Queries/ProfileFollowing.js +++ b/Projects/Network/NT/Modules/Queries/ProfileFollowing.js @@ -1,4 +1,4 @@ -exports.newProfileFollowing = function newProfileFollowing() { +exports.newNetworkModulesQueriesProfileFollowing = function newNetworkModulesQueriesProfileFollowing() { /* This module represents the query that allows a Network Client to know all the User or Bot profiles that are being followed by a certain User or Bot profile. diff --git a/Network/Queries/ProfilePosts.js b/Projects/Network/NT/Modules/Queries/ProfilePosts.js similarity index 95% rename from Network/Queries/ProfilePosts.js rename to Projects/Network/NT/Modules/Queries/ProfilePosts.js index 853451bf8..a20065330 100644 --- a/Network/Queries/ProfilePosts.js +++ b/Projects/Network/NT/Modules/Queries/ProfilePosts.js @@ -1,4 +1,4 @@ -exports.newProfilePosts = function newProfilePosts() { +exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQueriesUserProfileStats() { /* Each User or Bot Profile can have posts. This query is designed for Network Clients to fetch the posts diff --git a/Network/Queries/UserProfileStats.js b/Projects/Network/NT/Modules/Queries/UserProfileStats.js similarity index 93% rename from Network/Queries/UserProfileStats.js rename to Projects/Network/NT/Modules/Queries/UserProfileStats.js index b79deba1e..e093d03e2 100644 --- a/Network/Queries/UserProfileStats.js +++ b/Projects/Network/NT/Modules/Queries/UserProfileStats.js @@ -1,4 +1,4 @@ -exports.newUserProfileStats = function newUserProfileStats() { +exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQueriesUserProfileStats() { let thisObject = { profile: undefined, diff --git a/Network/Query.js b/Projects/Network/NT/Modules/Query.js similarity index 73% rename from Network/Query.js rename to Projects/Network/NT/Modules/Query.js index f69f56841..97fb101a0 100644 --- a/Network/Query.js +++ b/Projects/Network/NT/Modules/Query.js @@ -1,4 +1,4 @@ -exports.newQuery = function newQuery() { +exports.newNetworkModulesQuery = function newNetworkModulesQuery() { /* A Query is a call from a Network Client to a Network Node with the purpose to get @@ -41,49 +41,49 @@ exports.newQuery = function newQuery() { switch (thisObject.queryType) { case QUERY_TYPES.USER_PROFILE_STATS: { - thisObject.query = NT.modules.QUERY_USER_PROFILE_STATS.newUserProfileStats() + thisObject.query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.BOT_PROFILE_STATS: { - thisObject.query = NT.modules.QUERY_BOT_PROFILE_STATS.newBotProfileStats() + thisObject.query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_POSTS: { - thisObject.query = NT.modules.QUERY_PROFILE_POSTS.newProfilePosts() + thisObject.query = NT.modules.queriesProfilePosts.newNetworkModulesQueriesProfilePosts() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.POST_REPLIES: { - thisObject.query = NT.modules.QUERY_POST_REPLIES.newPostReplies() + thisObject.query = NT.modules.queriesPostReplies.newNetworkModulesQueriesPostReplies() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_FOLLOWERS: { - thisObject.query = NT.modules.QUERY_PROFILE_FOLLOWERS.newProfileFollowers() + thisObject.query = NT.modules.queriesProfileFollowers.newNetworkModulesQueriesProfileFollowers() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_FOLLOWING: { - thisObject.query = NT.modules.QUERY_PROFILE_FOLLOWING.newProfileFollowing() + thisObject.query = NT.modules.queriesProfileFollowing.newNetworkModulesQueriesProfileFollowing() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.maps.EVENTS: { - thisObject.query = NT.modules.QUERY_EVENTS.newEvents() + thisObject.query = NT.modules.queriesEvents.newNetworkModulesQueriesEvents() query.initialize(queryReceived) query.finalize() break diff --git a/Network/botProfile.js b/Projects/Network/NT/Modules/Social-Graph/BotProfile.js similarity index 100% rename from Network/botProfile.js rename to Projects/Network/NT/Modules/Social-Graph/BotProfile.js diff --git a/Network/post.js b/Projects/Network/NT/Modules/Social-Graph/Post.js similarity index 100% rename from Network/post.js rename to Projects/Network/NT/Modules/Social-Graph/Post.js diff --git a/Network/userProfile.js b/Projects/Network/NT/Modules/Social-Graph/UserProfile.js similarity index 100% rename from Network/userProfile.js rename to Projects/Network/NT/Modules/Social-Graph/UserProfile.js diff --git a/Network/Utilities/QueriesValidations.js b/Projects/Network/NT/Utilities/QueriesValidations.js similarity index 96% rename from Network/Utilities/QueriesValidations.js rename to Projects/Network/NT/Utilities/QueriesValidations.js index 11ac407a7..7441bfaf7 100644 --- a/Network/Utilities/QueriesValidations.js +++ b/Projects/Network/NT/Utilities/QueriesValidations.js @@ -1,4 +1,4 @@ -exports.newQueriesValidations = function newQueriesValidations() { +exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQueriesValidations() { /* This module have a few funcions that are often needed at Queries Modules. */ diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index b9a782d5f..27fe15415 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -1287,12 +1287,92 @@ } ], "modules": [ + { + "name": "Bot Profile Stats", + "propertyName": "queriesBotProfileStats", + "functionName": "newNetworkModulesQueriesBotProfileStats", + "fileName": "Queries/BotProfileStats.js" + }, + { + "name": "User Profile Stats", + "propertyName": "queriesUserProfileStats", + "functionName": "newNetworkModulesQueriesUserProfileStats", + "fileName": "Queries/UserProfileStats.js" + }, + { + "name": "Profile Posts", + "propertyName": "queriesProfilePosts", + "functionName": "newNetworkModulesQueriesProfilePosts", + "fileName": "Queries/ProfilePosts.js" + }, + { + "name": "Profile Followers", + "propertyName": "queriesProfileFollowers", + "functionName": "newNetworkModulesQueriesProfileFollowers", + "fileName": "Queries/ProfileFollowers.js" + }, + { + "name": "Profile Following", + "propertyName": "queriesProfileFollowing", + "functionName": "newNetworkModulesQueriesProfileFollowing", + "fileName": "Queries/ProfileFollowing.js" + }, + { + "name": "Post Replies", + "propertyName": "queriesPostReplies", + "functionName": "newNetworkModulesQueriesPostReplies", + "fileName": "Queries/PostReplies.js" + }, + { + "name": "Events", + "propertyName": "queriesEvents", + "functionName": "newNetworkModulesQueriesEvents", + "fileName": "Queries/Events.js" + }, + { + "name": "User Profile", + "propertyName": "socialGraphUserProfile", + "functionName": "newNetworkModulesSocialGraphUserProfile", + "fileName": "Social-Graph/UserProfile.js" + }, + { + "name": "Bot Profile", + "propertyName": "socialGraphBotProfile", + "functionName": "newNetworkModulesSocialGraphBotProfile", + "fileName": "Social-Graph/BotProfile.js" + }, + { + "name": "Post", + "propertyName": "socialGraphPost", + "functionName": "newNetworkModulesSocialGraphPost", + "fileName": "Social-Graph/Post.js" + }, + { + "name": "Bootstrap", + "propertyName": "bootstrap", + "functionName": "newNetworkModulesBootstrap", + "fileName": "Bootstrap.js" + }, + { + "name": "Query", + "propertyName": "Query", + "functionName": "newNetworkModulesQuery", + "fileName": "Query.js" + }, { "name": "Event", "propertyName": "event", "functionName": "newNetworkModulesEvent", "fileName": "Event.js" } + ], + "utilities": [ + { + "name": "Queries Validations", + "propertyName": "queriesValidations", + "functionName": "newNetworkUtilitiesQueriesValidations", + "fileName": "QueriesValidations.js" + } ] } }