Superalgos Network: Users Profiles loaded into Memory
This commit is contained in:
1 parent
a52e9aa0a9
commit
0bed570595
24 files changed
+3113
-68
No files matched your search
+1
-1
@@ -95,7 +95,7 @@ try {
|
||||
/*
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
CL.nodeModules = {
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
nodeFetch: require('node-fetch')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
exports.newEnvironment = function () {
|
||||
|
||||
let thisObject = {
|
||||
WEB_SERVER_URL: 'localhost',
|
||||
WEB_SOCKETS_INTERFACE_PORT: 18041,
|
||||
HTTP_INTERFACE_PORT: 34248,
|
||||
PATH_TO_TASK_SERVER: '../TaskServer',
|
||||
PATH_TO_DATA_STORAGE: '../Data-Storage',
|
||||
PATH_TO_PROJECTS: '../Projects',
|
||||
PATH_TO_LOG_FILES: '../Log-Files',
|
||||
PATH_TO_PROJECTS_REQUIRED: './Projects',
|
||||
PATH_TO_PROJECT_SCHEMA: '../Projects/ProjectsSchema.json',
|
||||
PATH_TO_UI: '../UI',
|
||||
PATH_TO_DATA_FILES: '../UI/Data-Files/src',
|
||||
PATH_TO_CLIENT: '../Client/',
|
||||
PATH_TO_DEFAULT_WORKSPACE: '../Projects/Foundations/Plugins/Workspaces',
|
||||
PATH_TO_MY_WORKSPACES: '../My-Workspaces',
|
||||
PATH_TO_FONTS: '../Client/WebServer/Fonts'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
}
|
||||
@@ -21,6 +21,7 @@ exports.newMultiProject = function () {
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.modules = {}
|
||||
projectInstance.taskModules = {}
|
||||
projectInstance.processModules = {}
|
||||
projectInstance.botModules = {}
|
||||
|
||||
+14
-6
@@ -22,7 +22,7 @@ It provides access to all modules built for Superalgos in general.
|
||||
*/
|
||||
global.SA = {}
|
||||
/* Load Environment Variables */
|
||||
let ENVIRONMENT = require('../Environment.js');
|
||||
let ENVIRONMENT = require('../EnvironmentForDebug.js');
|
||||
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
|
||||
global.env = ENVIRONMENT_MODULE
|
||||
/*
|
||||
@@ -34,12 +34,20 @@ Setting up the modules that will be available for the Servers Running inside thi
|
||||
*/
|
||||
let MULTI_PROJECT = require('../MultiProject.js');
|
||||
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
|
||||
MULTI_PROJECT_MODULE.initialize(CL, 'CL')
|
||||
MULTI_PROJECT_MODULE.initialize(NT, 'NT')
|
||||
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
|
||||
/*
|
||||
Node Modules Dependencies
|
||||
Setting up external dependencies.
|
||||
*/
|
||||
NT.nodeModules.web3 = require('web3')
|
||||
SA.nodeModules = {
|
||||
fs: require('fs'),
|
||||
nodeFetch: require('node-fetch'),
|
||||
web3: require('web3')
|
||||
}
|
||||
|
||||
let socialGraphService = NT.modules.socialGraph.newSocialGraph()
|
||||
socialGraphService.initialize()
|
||||
start()
|
||||
|
||||
async function start() {
|
||||
let socialGraphService = NT.projects.network.modules.socialGraph.newSocialGraph()
|
||||
await socialGraphService.initialize()
|
||||
}
|
||||
@@ -45,13 +45,13 @@ exports.newClientInterface = function newClientInterface() {
|
||||
*/
|
||||
|
||||
let eventReceived = JSON.parse(eventMessage)
|
||||
if (NT.globals.memory.maps.EVENTS.get(eventReceived.eventId) !== undefined) {
|
||||
if (NT.projects.network.globals.memory.maps.EVENTS.get(eventReceived.eventId) !== undefined) {
|
||||
throw ('Event Already Exists.')
|
||||
}
|
||||
|
||||
let event = NT.modules.event.newNetworkModulesEvent()
|
||||
let event = NT.projects.network.modules.event.newNetworkModulesEvent()
|
||||
event.initialize(eventReceived)
|
||||
NT.globals.memory.maps.EVENTS.set(eventReceived.eventId, event)
|
||||
NT.projects.network.globals.memory.maps.EVENTS.set(eventReceived.eventId, event)
|
||||
}
|
||||
|
||||
function queryReceived(queryMessage) {
|
||||
@@ -80,7 +80,7 @@ exports.newClientInterface = function newClientInterface() {
|
||||
*/
|
||||
|
||||
let queryReceived = JSON.parse(queryMessage)
|
||||
let query = NT.modules.queriesQuery.newNetworkModulesQuery()
|
||||
let query = NT.projects.network.modules.queriesQuery.newNetworkModulesQuery()
|
||||
query.initialize(queryReceived)
|
||||
return query.execute()
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ exports.newFoundationsUtilitiesWebAccess = function () {
|
||||
async function fetchAPIDataFile(url) {
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
||||
const fetch = CL.nodeModules.nodeFetch
|
||||
const fetch = SA.nodeModules.nodeFetch
|
||||
/*
|
||||
This is how we call the API.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ exports.newFoundationsUtilitiesPlugins = function () {
|
||||
|
||||
let path = global.env.PATH_TO_PROJECTS + '/' + project + '/Plugins/' + folder
|
||||
|
||||
CL.nodeModules.fs.readdir(path, (err, files) => {
|
||||
SA.nodeModules.fs.readdir(path, (err, files) => {
|
||||
if (err) {
|
||||
reject()
|
||||
return
|
||||
@@ -33,7 +33,7 @@ exports.newFoundationsUtilitiesPlugins = function () {
|
||||
|
||||
let path = global.env.PATH_TO_PROJECTS + '/' + project + '/Plugins/' + folder + '/' + fileName
|
||||
|
||||
CL.nodeModules.fs.readFile(path, onFileRead)
|
||||
SA.nodeModules.fs.readFile(path, onFileRead)
|
||||
|
||||
function onFileRead(err, file) {
|
||||
if (err) {
|
||||
|
||||
@@ -16,12 +16,13 @@ exports.newBootstrap = function newBootstrap() {
|
||||
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
async function initialize() {
|
||||
|
||||
let pluginFileNames = await SA.projects.foundations.utilities.plugins.getPluginFileNames(
|
||||
'Governance',
|
||||
'User-Profiles'
|
||||
)
|
||||
|
||||
for (let i = 0; i < pluginFileNames.length; i++) {
|
||||
let pluginFileName = pluginFileNames[i]
|
||||
|
||||
@@ -33,14 +34,14 @@ exports.newBootstrap = function newBootstrap() {
|
||||
|
||||
let userProfilePlugin = JSON.parse(pluginFileContent)
|
||||
let config = JSON.parse(userProfilePlugin.config)
|
||||
let signatureObject = JSON.parse(config.signature)
|
||||
let web3 = new NT.nodeModules.web3()
|
||||
let signatureObject = config.signature
|
||||
let web3 = new SA.nodeModules.web3()
|
||||
let bloackchainAddress = web3.eth.accounts.recover(signatureObject)
|
||||
let ranking = 0 // TODO: read the blockchain balance and transactions from the Treasury Account to calculate the profile ranking.
|
||||
let userProfileId = userProfilePlugin.id
|
||||
let userHandle = config.signature.message
|
||||
|
||||
let userProfile = NT.modules.socialGraphUserProfile.newNetworkModulesSocialGraphUserProfile()
|
||||
let userProfile = NT.projects.network.modules.socialGraphUserProfile.newNetworkModulesSocialGraphUserProfile()
|
||||
userProfile.initialize(
|
||||
userProfileId,
|
||||
userHandle,
|
||||
@@ -48,8 +49,8 @@ exports.newBootstrap = function newBootstrap() {
|
||||
ranking
|
||||
)
|
||||
|
||||
NT.globals.memory.maps.USER_PROFILES_BY_ID.set(userProfileId, userProfile)
|
||||
NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.set(userHandle, userProfile)
|
||||
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)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ exports.newNetworkModulesEvent = function newNetworkModulesEvent() {
|
||||
if (emitterUserProfileId === undefined) {
|
||||
throw ('Emitter User Profile Id Not Provided.')
|
||||
}
|
||||
emitterUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
|
||||
emitterUserProfile = NT.projects.network.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.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ exports.newNetworkModulesQueriesBotProfileStats = function newNetworkModulesQuer
|
||||
*/
|
||||
let userProfile
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
userProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
userProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
userProfile = NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
userProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (userProfile === undefined) {
|
||||
|
||||
@@ -29,7 +29,7 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents
|
||||
function execute() {
|
||||
let response = []
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
case NT.projects.network.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.globals.queryConstants.DIRECTION_PAST: {
|
||||
case NT.projects.network.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,8 +59,8 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents
|
||||
|
||||
Any of the above happening, means that indeed it is related.
|
||||
*/
|
||||
let emitterUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.emitterUserProfileId)
|
||||
let targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(eventReceived.targetUserProfileId)
|
||||
let emitterBotProfile = emitterUserProfile.bots.get(eventReceived.emitterBotProfileId)
|
||||
let targetBotProfile = targetUserProfile.bots.get(eventReceived.targetBotProfileId)
|
||||
let emitterPost = emitterUserProfile.posts.get(eventReceived.emitterPostHash)
|
||||
@@ -217,28 +217,28 @@ exports.newNetworkModulesQueriesEvents = function newNetworkModulesQueriesEvents
|
||||
}
|
||||
|
||||
if (emitterUserProfile !== undefined) {
|
||||
let query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
let query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
query.initialize({ targetUserProfileId: event.emitterUserProfileId })
|
||||
eventResponse.emitterUserProfile = query.execute()
|
||||
query.finalize()
|
||||
}
|
||||
|
||||
if (targetUserProfile !== undefined) {
|
||||
let query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
let query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
query.initialize({ targetUserProfileId: event.targetUserProfileId })
|
||||
eventResponse.targetUserProfile = query.execute()
|
||||
query.finalize()
|
||||
}
|
||||
|
||||
if (emitterBotProfile !== undefined) {
|
||||
let query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
let query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
query.initialize({ targetUserProfileId: event.emitterUserProfileId, targetBotProfileId: emitterBotProfileId })
|
||||
eventResponse.emitterBotProfile = query.execute()
|
||||
query.finalize()
|
||||
}
|
||||
|
||||
if (targetBotProfile !== undefined) {
|
||||
let query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
let query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
query.initialize({ targetUserProfileId: event.targetUserProfileId, targetBotProfileId: targetBotProfileId })
|
||||
eventResponse.targetBotProfile = query.execute()
|
||||
query.finalize()
|
||||
|
||||
@@ -39,7 +39,7 @@ exports.newNetworkModulesQueriesPostReplies = function newNetworkModulesQueriesP
|
||||
let array = Array.from(thisObject.post.replies)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
case NT.projects.network.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.globals.queryConstants.DIRECTION_PAST: {
|
||||
case NT.projects.network.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (post === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newNetworkModulesQueriesProfileFollowers = function newNetworkModulesQue
|
||||
let array = Array.from(thisObject.profile.followers)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
case NT.projects.network.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.globals.queryConstants.DIRECTION_PAST: {
|
||||
case NT.projects.network.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -32,7 +32,7 @@ exports.newNetworkModulesQueriesProfileFollowing = function newNetworkModulesQue
|
||||
let array = Array.from(thisObject.profile.following)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
case NT.projects.network.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.globals.queryConstants.DIRECTION_PAST: {
|
||||
case NT.projects.network.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -35,7 +35,7 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue
|
||||
let array = Array.from(thisObject.profile.posts)
|
||||
|
||||
switch (thisObject.direction) {
|
||||
case NT.globals.queryConstants.DIRECTION_FUTURE: {
|
||||
case NT.projects.network.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.globals.queryConstants.DIRECTION_PAST: {
|
||||
case NT.projects.network.globals.queryConstants.DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let arrayItem = array[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
|
||||
@@ -18,9 +18,9 @@ exports.newNetworkModulesQueriesUserProfileStats = function newNetworkModulesQue
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
} else {
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
thisObject.profile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_HANDLE.get(queryReceived.targetUserProfileHandle)
|
||||
}
|
||||
|
||||
if (thisObject.profile === undefined) {
|
||||
|
||||
@@ -41,49 +41,49 @@ exports.newNetworkModulesQuery = function newNetworkModulesQuery() {
|
||||
switch (thisObject.queryType) {
|
||||
|
||||
case QUERY_TYPES.USER_PROFILE_STATS: {
|
||||
thisObject.query = NT.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
thisObject.query = NT.projects.network.modules.queriesUserProfileStats.newNetworkModulesQueriesUserProfileStats()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.BOT_PROFILE_STATS: {
|
||||
thisObject.query = NT.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
thisObject.query = NT.projects.network.modules.queriesBotProfileStats.newNetworkModulesQueriesBotProfileStats()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.PROFILE_POSTS: {
|
||||
thisObject.query = NT.modules.queriesProfilePosts.newNetworkModulesQueriesProfilePosts()
|
||||
thisObject.query = NT.projects.network.modules.queriesProfilePosts.newNetworkModulesQueriesProfilePosts()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.POST_REPLIES: {
|
||||
thisObject.query = NT.modules.queriesPostReplies.newNetworkModulesQueriesPostReplies()
|
||||
thisObject.query = NT.projects.network.modules.queriesPostReplies.newNetworkModulesQueriesPostReplies()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.PROFILE_FOLLOWERS: {
|
||||
thisObject.query = NT.modules.queriesProfileFollowers.newNetworkModulesQueriesProfileFollowers()
|
||||
thisObject.query = NT.projects.network.modules.queriesProfileFollowers.newNetworkModulesQueriesProfileFollowers()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.PROFILE_FOLLOWING: {
|
||||
thisObject.query = NT.modules.queriesProfileFollowing.newNetworkModulesQueriesProfileFollowing()
|
||||
thisObject.query = NT.projects.network.modules.queriesProfileFollowing.newNetworkModulesQueriesProfileFollowing()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
}
|
||||
|
||||
case QUERY_TYPES.maps.EVENTS: {
|
||||
thisObject.query = NT.modules.queriesEvents.newNetworkModulesQueriesEvents()
|
||||
thisObject.query = NT.projects.network.modules.queriesEvents.newNetworkModulesQueriesEvents()
|
||||
query.initialize(queryReceived)
|
||||
query.finalize()
|
||||
break
|
||||
|
||||
@@ -80,7 +80,7 @@ exports.newNetworkModulesSocialGraphBotProfile = function newNetworkModulesSocia
|
||||
if (thisObject.posts.get(emitterPostHash) !== undefined) {
|
||||
throw ('Post Already Exists.')
|
||||
} else {
|
||||
let post = NT.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
let post = NT.projects.network.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
post.initialize(
|
||||
emitterUserProfileId,
|
||||
targetUserProfileId,
|
||||
|
||||
@@ -97,7 +97,7 @@ exports.newNetworkModulesSocialGraphPost = function newNetworkModulesSocialGraph
|
||||
/*
|
||||
Validate Target User Profile.
|
||||
*/
|
||||
let targetUserProfile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
let targetUserProfile = NT.projects.network.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.targetUserProfileId)
|
||||
if (targetUserProfile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSoci
|
||||
if (thisObject.posts.get(emitterPostHash) !== undefined) {
|
||||
throw ('Post Already Exists.')
|
||||
} else {
|
||||
let post = NT.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
let post = NT.projects.network.modules.socialGraphPost.newNetworkModulesSocialGraphPost()
|
||||
post.initialize(
|
||||
emitterUserProfileId,
|
||||
targetUserProfileId,
|
||||
@@ -159,7 +159,7 @@ exports.newNetworkModulesSocialGraphUserProfile = function newNetworkModulesSoci
|
||||
if (bot !== undefined) {
|
||||
throw ('Bot Already Exists.')
|
||||
} else {
|
||||
let bot = NT.modules.BOTS.newBot()
|
||||
let bot = NT.projects.network.modules.BOTS.newBot()
|
||||
bot.initialize(
|
||||
userProfileId,
|
||||
botProfileId,
|
||||
|
||||
@@ -20,8 +20,8 @@ exports.newSocialGraph = function newSocialGraph() {
|
||||
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
let bootstrapProcess = NT.modules.bootstrap.newBootstrap()
|
||||
bootstrapProcess.initialize()
|
||||
async function initialize() {
|
||||
let bootstrapProcess = NT.projects.network.modules.bootstrap.newBootstrap()
|
||||
await bootstrapProcess.initialize()
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ exports.newNetworkUtilitiesQueriesValidations = function newNetworkUtilitiesQuer
|
||||
Validate User Profile
|
||||
*/
|
||||
if (queryReceived.targetUserProfileId !== undefined) {
|
||||
thisObject.profile = NT.globals.memory.maps.USER_PROFILES_BY_ID.get(queryReceived.targetUserProfileId)
|
||||
thisObject.profile = NT.projects.network.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.globals.queryConstants.INITIAL_INDEX_LAST) {
|
||||
if (queryReceived.initialIndex === NT.projects.network.globals.queryConstants.INITIAL_INDEX_LAST) {
|
||||
queryReceived.initialIndex = thisObject.profile.posts.length - 1
|
||||
}
|
||||
|
||||
if (queryReceived.initialIndex === NT.globals.queryConstants.INITIAL_INDEX_FIRST) {
|
||||
if (queryReceived.initialIndex === NT.projects.network.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.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested < NT.projects.network.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
|
||||
throw ('Amount Requested Below Min.')
|
||||
}
|
||||
|
||||
if (queryReceived.amountRequested > NT.globals.queryConstants.MAX_AMOUNT_REQUESTED) {
|
||||
if (queryReceived.amountRequested > NT.projects.network.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.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.globals.queryConstants.DIRECTION_PAST) {
|
||||
if (queryReceived.direction !== NT.projects.network.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.projects.network.globals.queryConstants.DIRECTION_PAST) {
|
||||
throw ('Direction Not Supported.')
|
||||
}
|
||||
|
||||
|
||||
Generated
+3011
-3
File diff suppressed because it is too large.
Load diff
+6
-1
@@ -1 +1,6 @@
|
||||
{}
|
||||
{
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.1",
|
||||
"web3": "^1.5.2"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user