From b47b9b3dcf57b9e43e7705a0246f4af3ec894667 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 31 Aug 2021 14:42:44 +0200 Subject: [PATCH] Adding the Social Trading Project --- Desktop/DesktopApp.js | 26 ++ .../.vscode/Superalgos Network.code-workspace | 3 + Network/NetwokNode.js | 2 +- .../Network/NT/Modules/WebSocketsInterface.js | 6 +- Projects/ProjectsSchema.json | 232 +++++++++--------- .../NT/Globals/Memory.js | 2 +- .../NT/Globals/QueryConstants.js | 2 +- .../NT/Modules/Bootstrap.js | 8 +- .../NT/Modules/ClientInterface.js | 10 +- .../NT/Modules/Event.js | 6 +- .../NT/Modules/PeerInterface.js | 2 +- .../NT/Modules/Queries/BotProfileStats.js | 6 +- .../NT/Modules/Queries/Events.js | 18 +- .../NT/Modules/Queries/PostReplies.js | 6 +- .../NT/Modules/Queries/ProfileFollowers.js | 6 +- .../NT/Modules/Queries/ProfileFollowing.js | 6 +- .../NT/Modules/Queries/ProfilePosts.js | 6 +- .../NT/Modules/Queries/UserProfileStats.js | 6 +- .../NT/Modules/Query.js | 16 +- .../NT/Modules/Social-Graph/BotProfile.js | 4 +- .../NT/Modules/Social-Graph/Post.js | 4 +- .../NT/Modules/Social-Graph/UserProfile.js | 6 +- .../NT/Modules/SocialGraph.js | 2 +- .../NT/Utilities/QueriesValidations.js | 14 +- runDesktop.js | 51 ++++ 25 files changed, 270 insertions(+), 180 deletions(-) create mode 100644 Desktop/DesktopApp.js rename Projects/{Network => Social-Trading}/NT/Globals/Memory.js (94%) rename Projects/{Network => Social-Trading}/NT/Globals/QueryConstants.js (80%) rename Projects/{Network => Social-Trading}/NT/Modules/Bootstrap.js (77%) rename Projects/{Network => Social-Trading}/NT/Modules/ClientInterface.js (93%) rename Projects/{Network => Social-Trading}/NT/Modules/Event.js (97%) rename Projects/{Network => Social-Trading}/NT/Modules/PeerInterface.js (71%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/BotProfileStats.js (78%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/Events.js (91%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/PostReplies.js (90%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/ProfileFollowers.js (86%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/ProfileFollowing.js (86%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/ProfilePosts.js (89%) rename Projects/{Network => Social-Trading}/NT/Modules/Queries/UserProfileStats.js (75%) rename Projects/{Network => Social-Trading}/NT/Modules/Query.js (68%) rename Projects/{Network => Social-Trading}/NT/Modules/Social-Graph/BotProfile.js (94%) rename Projects/{Network => Social-Trading}/NT/Modules/Social-Graph/Post.js (94%) rename Projects/{Network => Social-Trading}/NT/Modules/Social-Graph/UserProfile.js (94%) rename Projects/{Network => Social-Trading}/NT/Modules/SocialGraph.js (88%) rename Projects/{Network => Social-Trading}/NT/Utilities/QueriesValidations.js (73%) create mode 100644 runDesktop.js diff --git a/Desktop/DesktopApp.js b/Desktop/DesktopApp.js new file mode 100644 index 000000000..6f2bef1ff --- /dev/null +++ b/Desktop/DesktopApp.js @@ -0,0 +1,26 @@ +exports.newDesktopApp = function newDesktopApp() { + + let thisObject = { + run: run + } + + return thisObject + + function run() { + /* + Let's start the Network Interfaces + */ + DK.webSocketsClient = DK.projects.network.modules.webSocketsClient.newDesktopModulesWebSocketsClient() + DK.webSocketsClient.initialize() + + + return + start() + + async function start() { + let socialGraphService = NT.projects.network.modules.socialGraph.newSocialGraph() + await socialGraphService.initialize() + } + + } +} diff --git a/Network/.vscode/Superalgos Network.code-workspace b/Network/.vscode/Superalgos Network.code-workspace index 757812e5e..9970dd1eb 100644 --- a/Network/.vscode/Superalgos Network.code-workspace +++ b/Network/.vscode/Superalgos Network.code-workspace @@ -5,6 +5,9 @@ }, { "path": "C:\\Superalgos\\Projects\\Network" + }, + { + "path": "C:\\Superalgos\\Projects\\Social-Trading" } ], "settings": {} diff --git a/Network/NetwokNode.js b/Network/NetwokNode.js index 8406c76df..af1913a24 100644 --- a/Network/NetwokNode.js +++ b/Network/NetwokNode.js @@ -16,7 +16,7 @@ exports.newNetworkNode = function newNetworkNode() { start() async function start() { - let socialGraphService = NT.projects.network.modules.socialGraph.newSocialGraph() + let socialGraphService = NT.projects.socialTrading.modules.socialGraph.newSocialGraph() await socialGraphService.initialize() } diff --git a/Projects/Network/NT/Modules/WebSocketsInterface.js b/Projects/Network/NT/Modules/WebSocketsInterface.js index 912a66740..6314b0e95 100644 --- a/Projects/Network/NT/Modules/WebSocketsInterface.js +++ b/Projects/Network/NT/Modules/WebSocketsInterface.js @@ -19,8 +19,8 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock function initialize() { socketServer = new SA.nodeModules.ws.Server({ port: global.env.NETWORK_WEB_SOCKETS_INTERFACE_PORT }) - clientInterface = NT.projects.network.modules.clientInterface.newNetworkModulesClientInterface() - peerInterface = NT.projects.network.modules.peerInterface.newNetworkModulesPeerInterface() + clientInterface = NT.projects.socialTrading.modules.clientInterface.newSocialTradingModulesClientInterface() + peerInterface = NT.projects.socialTrading.modules.peerInterface.newSocialTradingModulesPeerInterface() setUpWebSocketServer() } @@ -144,7 +144,7 @@ exports.newNetworkModulesWebSocketsInterface = function newNetworkModulesWebSock /* The signature gives us the blockchain account, and the account the user profile. */ - let userProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOCHAIN_ACCOUNT.set(blockchainAccount) + let userProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_BLOCHAIN_ACCOUNT.set(blockchainAccount) if (userProfile === undefined) { let response = { diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index 7b9676298..0ba8c9061 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -1272,117 +1272,8 @@ "name": "Network", "propertyName": "network", "NT": { - "globals": [ - { - "name": "Query Constants", - "propertyName": "queryConstants", - "functionName": "newNetworkGlobalsQueryConstants", - "fileName": "QueryConstants.js" - }, - { - "name": "Memory", - "propertyName": "memory", - "functionName": "newNetworkGlobalsMemory", - "fileName": "Memory.js" - } - ], + "globals": [], "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": "Social Graph", - "propertyName": "socialGraph", - "functionName": "newNetworkModulesSocialGraph", - "fileName": "SocialGraph.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" - }, - { - "name": "Client Interface", - "propertyName": "clientInterface", - "functionName": "newNetworkModulesClientInterface", - "fileName": "ClientInterface.js" - }, - { - "name": "Peer Interface", - "propertyName": "peerInterface", - "functionName": "newNetworkModulesPeerInterface", - "fileName": "PeerInterface.js" - }, { "name": "Web Sockets Interface", "propertyName": "webSocketsInterface", @@ -1390,11 +1281,130 @@ "fileName": "WebSocketsInterface.js" } ], + "utilities": [] + } + }, + { + "name": "Social-Trading", + "propertyName": "socialTrading", + "NT": { + "globals": [ + { + "name": "Query Constants", + "propertyName": "queryConstants", + "functionName": "newSocialTradingGlobalsQueryConstants", + "fileName": "QueryConstants.js" + }, + { + "name": "Memory", + "propertyName": "memory", + "functionName": "newSocialTradingGlobalsMemory", + "fileName": "Memory.js" + } + ], + "modules": [ + { + "name": "Bot Profile Stats", + "propertyName": "queriesBotProfileStats", + "functionName": "newSocialTradingModulesQueriesBotProfileStats", + "fileName": "Queries/BotProfileStats.js" + }, + { + "name": "User Profile Stats", + "propertyName": "queriesUserProfileStats", + "functionName": "newSocialTradingModulesQueriesUserProfileStats", + "fileName": "Queries/UserProfileStats.js" + }, + { + "name": "Profile Posts", + "propertyName": "queriesProfilePosts", + "functionName": "newSocialTradingModulesQueriesProfilePosts", + "fileName": "Queries/ProfilePosts.js" + }, + { + "name": "Profile Followers", + "propertyName": "queriesProfileFollowers", + "functionName": "newSocialTradingModulesQueriesProfileFollowers", + "fileName": "Queries/ProfileFollowers.js" + }, + { + "name": "Profile Following", + "propertyName": "queriesProfileFollowing", + "functionName": "newSocialTradingModulesQueriesProfileFollowing", + "fileName": "Queries/ProfileFollowing.js" + }, + { + "name": "Post Replies", + "propertyName": "queriesPostReplies", + "functionName": "newSocialTradingModulesQueriesPostReplies", + "fileName": "Queries/PostReplies.js" + }, + { + "name": "Events", + "propertyName": "queriesEvents", + "functionName": "newSocialTradingModulesQueriesEvents", + "fileName": "Queries/Events.js" + }, + { + "name": "User Profile", + "propertyName": "socialGraphUserProfile", + "functionName": "newSocialTradingModulesSocialGraphUserProfile", + "fileName": "Social-Graph/UserProfile.js" + }, + { + "name": "Bot Profile", + "propertyName": "socialGraphBotProfile", + "functionName": "newSocialTradingModulesSocialGraphBotProfile", + "fileName": "Social-Graph/BotProfile.js" + }, + { + "name": "Post", + "propertyName": "socialGraphPost", + "functionName": "newSocialTradingModulesSocialGraphPost", + "fileName": "Social-Graph/Post.js" + }, + { + "name": "Social Graph", + "propertyName": "socialGraph", + "functionName": "newSocialTradingModulesSocialGraph", + "fileName": "SocialGraph.js" + }, + { + "name": "Bootstrap", + "propertyName": "bootstrap", + "functionName": "newSocialTradingModulesBootstrap", + "fileName": "Bootstrap.js" + }, + { + "name": "Query", + "propertyName": "Query", + "functionName": "newSocialTradingModulesQuery", + "fileName": "Query.js" + }, + { + "name": "Event", + "propertyName": "event", + "functionName": "newSocialTradingModulesEvent", + "fileName": "Event.js" + }, + { + "name": "Client Interface", + "propertyName": "clientInterface", + "functionName": "newSocialTradingModulesClientInterface", + "fileName": "ClientInterface.js" + }, + { + "name": "Peer Interface", + "propertyName": "peerInterface", + "functionName": "newSocialTradingModulesPeerInterface", + "fileName": "PeerInterface.js" + } + ], "utilities": [ { "name": "Queries Validations", "propertyName": "queriesValidations", - "functionName": "newNetworkUtilitiesQueriesValidations", + "functionName": "newSocialTradingUtilitiesQueriesValidations", "fileName": "QueriesValidations.js" } ] diff --git a/Projects/Network/NT/Globals/Memory.js b/Projects/Social-Trading/NT/Globals/Memory.js similarity index 94% rename from Projects/Network/NT/Globals/Memory.js rename to Projects/Social-Trading/NT/Globals/Memory.js index 1c5fbb70d..6a42e762a 100644 --- a/Projects/Network/NT/Globals/Memory.js +++ b/Projects/Social-Trading/NT/Globals/Memory.js @@ -1,4 +1,4 @@ -exports.newNetworkGlobalsMemory = function () { +exports.newSocialTradingGlobalsMemory = function () { /* Here is the Data we are going to keep in memory. */ diff --git a/Projects/Network/NT/Globals/QueryConstants.js b/Projects/Social-Trading/NT/Globals/QueryConstants.js similarity index 80% rename from Projects/Network/NT/Globals/QueryConstants.js rename to Projects/Social-Trading/NT/Globals/QueryConstants.js index 92737b6b4..8f62db770 100644 --- a/Projects/Network/NT/Globals/QueryConstants.js +++ b/Projects/Social-Trading/NT/Globals/QueryConstants.js @@ -1,4 +1,4 @@ -exports.newNetworkGlobalsQueryConstants = function () { +exports.newSocialTradingGlobalsQueryConstants = function () { let thisObject = { INITIAL_INDEX_FIRST: 'First', diff --git a/Projects/Network/NT/Modules/Bootstrap.js b/Projects/Social-Trading/NT/Modules/Bootstrap.js similarity index 77% rename from Projects/Network/NT/Modules/Bootstrap.js rename to Projects/Social-Trading/NT/Modules/Bootstrap.js index c98029769..58ab6bbe1 100644 --- a/Projects/Network/NT/Modules/Bootstrap.js +++ b/Projects/Social-Trading/NT/Modules/Bootstrap.js @@ -41,7 +41,7 @@ exports.newBootstrap = function newBootstrap() { let userProfileId = userProfilePlugin.id let userHandle = config.signature.message - let userProfile = NT.projects.network.modules.socialGraphUserProfile.newNetworkModulesSocialGraphUserProfile() + let userProfile = NT.projects.socialTrading.modules.socialGraphUserProfile.newSocialTradingModulesSocialGraphUserProfile() userProfile.initialize( userProfileId, userHandle, @@ -49,9 +49,9 @@ exports.newBootstrap = function newBootstrap() { ranking ) - NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile) - NT.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile) - NT.projects.network.globals.memory.maps.USER_PROFILES_BY_BLOCHAIN_ACCOUNT.set(blockchainAccount, userProfile) + NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile) + NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile) + NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_BLOCHAIN_ACCOUNT.set(blockchainAccount, userProfile) } } diff --git a/Projects/Network/NT/Modules/ClientInterface.js b/Projects/Social-Trading/NT/Modules/ClientInterface.js similarity index 93% rename from Projects/Network/NT/Modules/ClientInterface.js rename to Projects/Social-Trading/NT/Modules/ClientInterface.js index d96d5d419..bbfd8b8f1 100644 --- a/Projects/Network/NT/Modules/ClientInterface.js +++ b/Projects/Social-Trading/NT/Modules/ClientInterface.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesClientInterface = function newNetworkModulesClientInterface() { +exports.newSocialTradingModulesClientInterface = function newSocialTradingModulesClientInterface() { /* This module represents the Interface the Network Node have with Network Clients connected to it. There are two things @@ -106,7 +106,7 @@ exports.newNetworkModulesClientInterface = function newNetworkModulesClientInter We will not accept events that have already been processed. */ - if (NT.projects.network.globals.memory.maps.EVENTS.get(eventReceived.eventId) !== undefined) { + if (NT.projects.socialTrading.globals.memory.maps.EVENTS.get(eventReceived.eventId) !== undefined) { let response = { result: 'Error', message: 'Client Interface Event Already Exists.' @@ -117,9 +117,9 @@ exports.newNetworkModulesClientInterface = function newNetworkModulesClientInter Here we will process the event and change the state of the Social Graph. */ try { - let event = NT.projects.network.modules.event.newNetworkModulesEvent() + let event = NT.projects.socialTrading.modules.event.newSocialTradingModulesEvent() event.initialize(eventReceived) - NT.projects.network.globals.memory.maps.EVENTS.set(eventReceived.eventId, event) + NT.projects.socialTrading.globals.memory.maps.EVENTS.set(eventReceived.eventId, event) let response = { result: 'Ok', @@ -190,7 +190,7 @@ exports.newNetworkModulesClientInterface = function newNetworkModulesClientInter Here we will process the query. This does not change the state of the Social Graph. */ try { - let query = NT.projects.network.modules.queriesQuery.newNetworkModulesQuery() + let query = NT.projects.socialTrading.modules.queriesQuery.newSocialTradingModulesQuery() query.initialize(queryReceived) return query.execute() diff --git a/Projects/Network/NT/Modules/Event.js b/Projects/Social-Trading/NT/Modules/Event.js similarity index 97% rename from Projects/Network/NT/Modules/Event.js rename to Projects/Social-Trading/NT/Modules/Event.js index adbc87424..bd39bcb81 100644 --- a/Projects/Network/NT/Modules/Event.js +++ b/Projects/Social-Trading/NT/Modules/Event.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesEvent = function newNetworkModulesEvent() { +exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() { /* An Event is anything that happens system wide that needs to be delivered to relevant entities via @@ -104,7 +104,7 @@ exports.newNetworkModulesEvent = function newNetworkModulesEvent() { if (emitterUserProfileId === undefined) { throw ('Emitter User Profile Id Not Provided.') } - emitterUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId) + emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId) if (emitterUserProfile === undefined) { throw ('Emitter User Profile Not Found.') } @@ -112,7 +112,7 @@ exports.newNetworkModulesEvent = function newNetworkModulesEvent() { Validate Target User Profile. */ if (thisObject.targetUserProfileId !== undefined) { - targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId) + targetUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId) if (targetUserProfile === undefined) { throw ('Target User Profile Not Found.') } diff --git a/Projects/Network/NT/Modules/PeerInterface.js b/Projects/Social-Trading/NT/Modules/PeerInterface.js similarity index 71% rename from Projects/Network/NT/Modules/PeerInterface.js rename to Projects/Social-Trading/NT/Modules/PeerInterface.js index 44c4412b0..6cb730381 100644 --- a/Projects/Network/NT/Modules/PeerInterface.js +++ b/Projects/Social-Trading/NT/Modules/PeerInterface.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesPeerInterface = function newNetworkModulesPeerInterface() { +exports.newSocialTradingModulesPeerInterface = function newSocialTradingModulesPeerInterface() { let thisObject = { initialize: initialize, diff --git a/Projects/Network/NT/Modules/Queries/BotProfileStats.js b/Projects/Social-Trading/NT/Modules/Queries/BotProfileStats.js similarity index 78% rename from Projects/Network/NT/Modules/Queries/BotProfileStats.js rename to Projects/Social-Trading/NT/Modules/Queries/BotProfileStats.js index 9afa338e8..2db10f72b 100644 --- a/Projects/Network/NT/Modules/Queries/BotProfileStats.js +++ b/Projects/Social-Trading/NT/Modules/Queries/BotProfileStats.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesBotProfileStats = function newNetworkModulesQueriesBotProfileStats() { +exports.newSocialTradingModulesQueriesBotProfileStats = function newSocialTradingModulesQueriesBotProfileStats() { let thisObject = { profile: undefined, @@ -19,9 +19,9 @@ exports.newNetworkModulesQueriesBotProfileStats = function newNetworkModulesQuer */ let userProfile if (queryReceived.targetUserProfileId !== undefined) { - userProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) + userProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) } else { - userProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle) + userProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle) } if (userProfile === undefined) { diff --git a/Projects/Network/NT/Modules/Queries/Events.js b/Projects/Social-Trading/NT/Modules/Queries/Events.js similarity index 91% rename from Projects/Network/NT/Modules/Queries/Events.js rename to Projects/Social-Trading/NT/Modules/Queries/Events.js index 9d3c2b25b..0565bf027 100644 --- a/Projects/Network/NT/Modules/Queries/Events.js +++ b/Projects/Social-Trading/NT/Modules/Queries/Events.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents() { +exports.newSocialTradingModulesQueriesEvents = function newSocialTradingModulesQueriesEvents() { /* This is the query executed to fill the timeline of a certain User or Bot Profile. @@ -29,7 +29,7 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents function execute() { let response = [] switch (thisObject.direction) { - case NT.projects.network.globals.queryConstants.DIRECTION_FUTURE: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: { for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) { let event = NT.memory.arrays.EVENTS[i] if (event === undefined) { break } @@ -37,7 +37,7 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents } break } - case NT.projects.network.globals.queryConstants.DIRECTION_PAST: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: { for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) { let event = NT.memory.arrays.EVENTS[i] if (event === undefined) { break } @@ -59,11 +59,11 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents Any of the above happening, means that indeed it is related. */ - let emitterUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId) + let emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId) let emitterBotProfile = emitterUserProfile.bots.get(eventReceived.emitterBotProfileId) let emitterPost = emitterUserProfile.posts.get(eventReceived.emitterPostHash) - let targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId) + let targetUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId) let targetBotProfile let targetPost @@ -223,28 +223,28 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents } if (emitterUserProfile !== undefined) { - let query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() + let query = NT.projects.socialTrading.modules.queriesUserProfileStats.newSocialTradingModulesQueriesUserProfileStats() query.initialize({ targetUserProfileId: event.emitterUserProfileId }) eventResponse.emitterUserProfile = query.execute() query.finalize() } if (targetUserProfile !== undefined) { - let query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() + let query = NT.projects.socialTrading.modules.queriesUserProfileStats.newSocialTradingModulesQueriesUserProfileStats() query.initialize({ targetUserProfileId: event.targetUserProfileId }) eventResponse.targetUserProfile = query.execute() query.finalize() } if (emitterBotProfile !== undefined) { - let query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() + let query = NT.projects.socialTrading.modules.queriesBotProfileStats.newSocialTradingModulesQueriesBotProfileStats() query.initialize({ targetUserProfileId: event.emitterUserProfileId, targetBotProfileId: emitterBotProfileId }) eventResponse.emitterBotProfile = query.execute() query.finalize() } if (targetBotProfile !== undefined) { - let query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() + let query = NT.projects.socialTrading.modules.queriesBotProfileStats.newSocialTradingModulesQueriesBotProfileStats() query.initialize({ targetUserProfileId: event.targetUserProfileId, targetBotProfileId: targetBotProfileId }) eventResponse.targetBotProfile = query.execute() query.finalize() diff --git a/Projects/Network/NT/Modules/Queries/PostReplies.js b/Projects/Social-Trading/NT/Modules/Queries/PostReplies.js similarity index 90% rename from Projects/Network/NT/Modules/Queries/PostReplies.js rename to Projects/Social-Trading/NT/Modules/Queries/PostReplies.js index 4d7400049..4c0b63ecf 100644 --- a/Projects/Network/NT/Modules/Queries/PostReplies.js +++ b/Projects/Social-Trading/NT/Modules/Queries/PostReplies.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesPostReplies = function newNetworkModulesQueriesPostReplies() { +exports.newSocialTradingModulesQueriesPostReplies = function newSocialTradingModulesQueriesPostReplies() { /* Each Post regardless if it is authored by a User or Bot Profile, can have replies. This query is designed for Network Clients to @@ -39,7 +39,7 @@ exports.newNetworkModulesQueriesPostReplies = function newNetworkModulesQueriesP let array = Array.from(thisObject.post.replies) switch (thisObject.direction) { - case NT.projects.network.globals.queryConstants.DIRECTION_FUTURE: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: { for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) { let arrayItem = array[i] if (post === undefined) { break } @@ -47,7 +47,7 @@ exports.newNetworkModulesQueriesPostReplies = function newNetworkModulesQueriesP } break } - case NT.projects.network.globals.queryConstants.DIRECTION_PAST: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: { for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) { let arrayItem = array[i] if (post === undefined) { break } diff --git a/Projects/Network/NT/Modules/Queries/ProfileFollowers.js b/Projects/Social-Trading/NT/Modules/Queries/ProfileFollowers.js similarity index 86% rename from Projects/Network/NT/Modules/Queries/ProfileFollowers.js rename to Projects/Social-Trading/NT/Modules/Queries/ProfileFollowers.js index 929074103..5b500c24c 100644 --- a/Projects/Network/NT/Modules/Queries/ProfileFollowers.js +++ b/Projects/Social-Trading/NT/Modules/Queries/ProfileFollowers.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesProfileFollowers = function newNetworkModulesQueriesProfileFollowers() { +exports.newSocialTradingModulesQueriesProfileFollowers = function newSocialTradingModulesQueriesProfileFollowers() { /* 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. @@ -32,7 +32,7 @@ exports.newNetworkModulesQueriesProfileFollowers = function newNetworkModulesQue let array = Array.from(thisObject.profile.followers) switch (thisObject.direction) { - case NT.projects.network.globals.queryConstants.DIRECTION_FUTURE: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: { for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) { let arrayItem = array[i] if (arrayItem === undefined) { break } @@ -40,7 +40,7 @@ exports.newNetworkModulesQueriesProfileFollowers = function newNetworkModulesQue } break } - case NT.projects.network.globals.queryConstants.DIRECTION_PAST: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: { for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) { let arrayItem = array[i] if (arrayItem === undefined) { break } diff --git a/Projects/Network/NT/Modules/Queries/ProfileFollowing.js b/Projects/Social-Trading/NT/Modules/Queries/ProfileFollowing.js similarity index 86% rename from Projects/Network/NT/Modules/Queries/ProfileFollowing.js rename to Projects/Social-Trading/NT/Modules/Queries/ProfileFollowing.js index 19d600d5d..aa21b6193 100644 --- a/Projects/Network/NT/Modules/Queries/ProfileFollowing.js +++ b/Projects/Social-Trading/NT/Modules/Queries/ProfileFollowing.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesProfileFollowing = function newNetworkModulesQueriesProfileFollowing() { +exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradingModulesQueriesProfileFollowing() { /* 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. @@ -32,7 +32,7 @@ exports.newNetworkModulesQueriesProfileFollowing = function newNetworkModulesQue let array = Array.from(thisObject.profile.following) switch (thisObject.direction) { - case NT.projects.network.globals.queryConstants.DIRECTION_FUTURE: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: { for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) { let arrayItem = array[i] if (arrayItem === undefined) { break } @@ -40,7 +40,7 @@ exports.newNetworkModulesQueriesProfileFollowing = function newNetworkModulesQue } break } - case NT.projects.network.globals.queryConstants.DIRECTION_PAST: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: { for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) { let arrayItem = array[i] if (arrayItem === undefined) { break } diff --git a/Projects/Network/NT/Modules/Queries/ProfilePosts.js b/Projects/Social-Trading/NT/Modules/Queries/ProfilePosts.js similarity index 89% rename from Projects/Network/NT/Modules/Queries/ProfilePosts.js rename to Projects/Social-Trading/NT/Modules/Queries/ProfilePosts.js index 07803098c..c14dcd49f 100644 --- a/Projects/Network/NT/Modules/Queries/ProfilePosts.js +++ b/Projects/Social-Trading/NT/Modules/Queries/ProfilePosts.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQueriesUserProfileStats() { +exports.newSocialTradingModulesQueriesUserProfileStats = function newSocialTradingModulesQueriesUserProfileStats() { /* Each User or Bot Profile can have posts. This query is designed for Network Clients to fetch the posts @@ -35,7 +35,7 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue let array = Array.from(thisObject.profile.posts) switch (thisObject.direction) { - case NT.projects.network.globals.queryConstants.DIRECTION_FUTURE: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: { for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) { let arrayItem = array[i] if (arrayItem === undefined) { break } @@ -43,7 +43,7 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue } break } - case NT.projects.network.globals.queryConstants.DIRECTION_PAST: { + case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: { for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) { let arrayItem = array[i] if (arrayItem === undefined) { break } diff --git a/Projects/Network/NT/Modules/Queries/UserProfileStats.js b/Projects/Social-Trading/NT/Modules/Queries/UserProfileStats.js similarity index 75% rename from Projects/Network/NT/Modules/Queries/UserProfileStats.js rename to Projects/Social-Trading/NT/Modules/Queries/UserProfileStats.js index 0c56e93e4..5825be95f 100644 --- a/Projects/Network/NT/Modules/Queries/UserProfileStats.js +++ b/Projects/Social-Trading/NT/Modules/Queries/UserProfileStats.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQueriesUserProfileStats() { +exports.newSocialTradingModulesQueriesUserProfileStats = function newSocialTradingModulesQueriesUserProfileStats() { let thisObject = { profile: undefined, @@ -18,9 +18,9 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue Validate User Profile */ if (queryReceived.targetUserProfileId !== undefined) { - thisObject.profile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) + thisObject.profile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) } else { - thisObject.profile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle) + thisObject.profile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle) } if (thisObject.profile === undefined) { diff --git a/Projects/Network/NT/Modules/Query.js b/Projects/Social-Trading/NT/Modules/Query.js similarity index 68% rename from Projects/Network/NT/Modules/Query.js rename to Projects/Social-Trading/NT/Modules/Query.js index aa0022a4c..1a3e9389b 100644 --- a/Projects/Network/NT/Modules/Query.js +++ b/Projects/Social-Trading/NT/Modules/Query.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesQuery = function newNetworkModulesQuery() { +exports.newSocialTradingModulesQuery = function newSocialTradingModulesQuery() { /* A Query is a call from a Network Client to a Network Node with the purpose to get @@ -41,49 +41,49 @@ exports.newNetworkModulesQuery = function newNetworkModulesQuery() { switch (thisObject.queryType) { case QUERY_TYPES.USER_PROFILE_STATS: { - thisObject.query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats() + thisObject.query = NT.projects.socialTrading.modules.queriesUserProfileStats.newSocialTradingModulesQueriesUserProfileStats() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.BOT_PROFILE_STATS: { - thisObject.query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats() + thisObject.query = NT.projects.socialTrading.modules.queriesBotProfileStats.newSocialTradingModulesQueriesBotProfileStats() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_POSTS: { - thisObject.query = NT.projects.network.modules.queriesProfilePosts.newNetworkModulesQueriesProfilePosts() + thisObject.query = NT.projects.socialTrading.modules.queriesProfilePosts.newSocialTradingModulesQueriesProfilePosts() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.POST_REPLIES: { - thisObject.query = NT.projects.network.modules.queriesPostReplies.newNetworkModulesQueriesPostReplies() + thisObject.query = NT.projects.socialTrading.modules.queriesPostReplies.newSocialTradingModulesQueriesPostReplies() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_FOLLOWERS: { - thisObject.query = NT.projects.network.modules.queriesProfileFollowers.newNetworkModulesQueriesProfileFollowers() + thisObject.query = NT.projects.socialTrading.modules.queriesProfileFollowers.newSocialTradingModulesQueriesProfileFollowers() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.PROFILE_FOLLOWING: { - thisObject.query = NT.projects.network.modules.queriesProfileFollowing.newNetworkModulesQueriesProfileFollowing() + thisObject.query = NT.projects.socialTrading.modules.queriesProfileFollowing.newSocialTradingModulesQueriesProfileFollowing() query.initialize(queryReceived) query.finalize() break } case QUERY_TYPES.maps.EVENTS: { - thisObject.query = NT.projects.network.modules.queriesEvents.newNetworkModulesQueriesEvents() + thisObject.query = NT.projects.socialTrading.modules.queriesEvents.newSocialTradingModulesQueriesEvents() query.initialize(queryReceived) query.finalize() break diff --git a/Projects/Network/NT/Modules/Social-Graph/BotProfile.js b/Projects/Social-Trading/NT/Modules/Social-Graph/BotProfile.js similarity index 94% rename from Projects/Network/NT/Modules/Social-Graph/BotProfile.js rename to Projects/Social-Trading/NT/Modules/Social-Graph/BotProfile.js index d860958df..2f1b41b47 100644 --- a/Projects/Network/NT/Modules/Social-Graph/BotProfile.js +++ b/Projects/Social-Trading/NT/Modules/Social-Graph/BotProfile.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesSocialGraphBotProfile = function newNetworkModulesSocialGraphBotProfile() { +exports.newSocialTradingModulesSocialGraphBotProfile = function newSocialTradingModulesSocialGraphBotProfile() { /* Users can have a Profile that can: * follow other bots profiles. @@ -80,7 +80,7 @@ exports.newNetworkModulesSocialGraphBotProfile = function newNetworkModulesSocia if (thisObject.posts.get(emitterPostHash) !== undefined) { throw ('Post Already Exists.') } else { - let post = NT.projects.network.modules.socialGraphPost.newNetworkModulesSocialGraphPost() + let post = NT.projects.socialTrading.modules.socialGraphPost.newSocialTradingModulesSocialGraphPost() post.initialize( emitterUserProfileId, targetUserProfileId, diff --git a/Projects/Network/NT/Modules/Social-Graph/Post.js b/Projects/Social-Trading/NT/Modules/Social-Graph/Post.js similarity index 94% rename from Projects/Network/NT/Modules/Social-Graph/Post.js rename to Projects/Social-Trading/NT/Modules/Social-Graph/Post.js index 36e3541d3..42ffbc346 100644 --- a/Projects/Network/NT/Modules/Social-Graph/Post.js +++ b/Projects/Social-Trading/NT/Modules/Social-Graph/Post.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesSocialGraphPost = function newNetworkModulesSocialGraphPost() { +exports.newSocialTradingModulesSocialGraphPost = function newSocialTradingModulesSocialGraphPost() { /* Posts represent a collection of multimedia content sotored somewhere else and identified by that content hash. Posts might belong to: @@ -97,7 +97,7 @@ exports.newNetworkModulesSocialGraphPost = function newNetworkModulesSocialGraph /* Validate Target User Profile. */ - let targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId) + let targetUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId) if (targetUserProfile === undefined) { throw ('Target User Profile Not Found.') } diff --git a/Projects/Network/NT/Modules/Social-Graph/UserProfile.js b/Projects/Social-Trading/NT/Modules/Social-Graph/UserProfile.js similarity index 94% rename from Projects/Network/NT/Modules/Social-Graph/UserProfile.js rename to Projects/Social-Trading/NT/Modules/Social-Graph/UserProfile.js index 527b36ef2..a54d0b6b2 100644 --- a/Projects/Network/NT/Modules/Social-Graph/UserProfile.js +++ b/Projects/Social-Trading/NT/Modules/Social-Graph/UserProfile.js @@ -1,4 +1,4 @@ -exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSocialGraphUserProfile() { +exports.newSocialTradingModulesSocialGraphUserProfile = function newSocialTradingModulesSocialGraphUserProfile() { /* Users can have a Profile that can: * follow other user profiles. @@ -84,7 +84,7 @@ exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSoci if (thisObject.posts.get(emitterPostHash) !== undefined) { throw ('Post Already Exists.') } else { - let post = NT.projects.network.modules.socialGraphPost.newNetworkModulesSocialGraphPost() + let post = NT.projects.socialTrading.modules.socialGraphPost.newSocialTradingModulesSocialGraphPost() post.initialize( emitterUserProfileId, targetUserProfileId, @@ -159,7 +159,7 @@ exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSoci if (bot !== undefined) { throw ('Bot Already Exists.') } else { - let bot = NT.projects.network.modules.BOTS.newBot() + let bot = NT.projects.socialTrading.modules.BOTS.newBot() bot.initialize( userProfileId, botProfileId, diff --git a/Projects/Network/NT/Modules/SocialGraph.js b/Projects/Social-Trading/NT/Modules/SocialGraph.js similarity index 88% rename from Projects/Network/NT/Modules/SocialGraph.js rename to Projects/Social-Trading/NT/Modules/SocialGraph.js index 0d475d950..3ac068e92 100644 --- a/Projects/Network/NT/Modules/SocialGraph.js +++ b/Projects/Social-Trading/NT/Modules/SocialGraph.js @@ -21,7 +21,7 @@ exports.newSocialGraph = function newSocialGraph() { } async function initialize() { - let bootstrapProcess = NT.projects.network.modules.bootstrap.newBootstrap() + let bootstrapProcess = NT.projects.socialTrading.modules.bootstrap.newBootstrap() await bootstrapProcess.initialize() } } \ No newline at end of file diff --git a/Projects/Network/NT/Utilities/QueriesValidations.js b/Projects/Social-Trading/NT/Utilities/QueriesValidations.js similarity index 73% rename from Projects/Network/NT/Utilities/QueriesValidations.js rename to Projects/Social-Trading/NT/Utilities/QueriesValidations.js index d98b58e4a..722b54835 100644 --- a/Projects/Network/NT/Utilities/QueriesValidations.js +++ b/Projects/Social-Trading/NT/Utilities/QueriesValidations.js @@ -1,4 +1,4 @@ -exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQueriesValidations() { +exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingUtilitiesQueriesValidations() { /* This module have a few funcions that are often needed at Queries Modules. */ @@ -15,7 +15,7 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer Validate User Profile */ if (queryReceived.targetUserProfileId !== undefined) { - thisObject.profile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) + thisObject.profile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId) } if (thisObject.profile === undefined) { @@ -51,11 +51,11 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer throw ('Initial Index Undefined.') } - if (queryReceived.initialIndex === NT.projects.network.globals.queryConstants.INITIAL_INDEX_LAST) { + if (queryReceived.initialIndex === NT.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST) { queryReceived.initialIndex = thisObject.profile.posts.length - 1 } - if (queryReceived.initialIndex === NT.projects.network.globals.queryConstants.INITIAL_INDEX_FIRST) { + if (queryReceived.initialIndex === NT.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST) { queryReceived.initialIndex = 0 } @@ -75,11 +75,11 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer throw ('Amount Requested Is Not a Number.') } - if (queryReceived.amountRequested < NT.projects.network.globals.queryConstants.MIN_AMOUNT_REQUESTED) { + if (queryReceived.amountRequested < NT.projects.socialTrading.globals.queryConstants.MIN_AMOUNT_REQUESTED) { throw ('Amount Requested Below Min.') } - if (queryReceived.amountRequested > NT.projects.network.globals.queryConstants.MAX_AMOUNT_REQUESTED) { + if (queryReceived.amountRequested > NT.projects.socialTrading.globals.queryConstants.MAX_AMOUNT_REQUESTED) { throw ('Amount Requested Above Max.') } /* @@ -89,7 +89,7 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer throw ('Direction Undefined.') } - if (queryReceived.direction !== NT.projects.network.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.projects.network.globals.queryConstants.DIRECTION_PAST) { + if (queryReceived.direction !== NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST) { throw ('Direction Not Supported.') } diff --git a/runDesktop.js b/runDesktop.js new file mode 100644 index 000000000..250438f83 --- /dev/null +++ b/runDesktop.js @@ -0,0 +1,51 @@ +/* +The Superalgos Desktop is one of the 3 clients of the Superalgos Network: + + * Superalgos Mobile + * Superalgos Desktop + * Superalgos Server + +Users can unse any of these clients for their social trading activities. + +This module is the starting point of the Superalgos Desktop App. + +*/ + +/* +The DK object is accesible everywhere at the Superalgos Desktop App. +It provides access to all modules built for this App. +*/ +global.DK = {} +/* +The SA object is accesible everywhere at the Superalgos Desktop App. +It provides access to all modules built for Superalgos in general. +*/ +global.SA = {} +/* Load Environment Variables */ +let ENVIRONMENT = require('./EnvironmentForDebug.js'); +let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment() +global.env = ENVIRONMENT_MODULE +/* +First thing is to load the project schema file. +*/ +global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA) +/* +Setting up the modules that will be available, defined at the Project Schema file. +*/ +let MULTI_PROJECT = require('./MultiProject.js'); +let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject() +MULTI_PROJECT_MODULE.initialize(DK, 'DK') +MULTI_PROJECT_MODULE.initialize(SA, 'SA') +/* +Setting up external dependencies. +*/ +SA.nodeModules = { + fs: require('fs'), + web3: require('web3'), + ws: require('ws') +} + +DK.app = require('./Network/DesktopApp.js').newNetworkNode() +DK.app.run() + +console.log('Superalgos Desktop is Running.') \ No newline at end of file