Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop

This commit is contained in:
Julian Molina committed 2021-09-05 13:16:19 +02:00
commit 27f4d411fc
132 files changed
+6274 -6098

No files matched your search

@@ -0,0 +1,54 @@
exports.newFoundationsUtilitiesFilesAndDirectories = function () {
let thisObject = {
getDirectories: getDirectories,
getAllFilesInDirectoryAndSubdirectories: getAllFilesInDirectoryAndSubdirectories
}
return thisObject
function getDirectories(path) {
try {
const fs = SA.nodeModules.fs
return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory();
});
} catch (err) {
return []
}
}
function getAllFilesInDirectoryAndSubdirectories(dir, callback) {
const { promisify } = require('util');
const { resolve } = require('path');
const fs = SA.nodeModules.fs;
const readdir = promisify(fs.readdir);
const stat = promisify(fs.stat);
getFiles(dir)
.then(files => {
let splittedDir = dir.split('/')
let lastFolder = splittedDir[splittedDir.length - 2]
let pathAndNames = []
for (let i = 0; i < files.length; i++) {
let file = files[i]
let pathName = file.substring(file.indexOf(lastFolder) + lastFolder.length, file.length)
pathName = pathName.substring(1, pathName.length)
pathAndNames.push(pathName)
}
callback(pathAndNames)
})
.catch(e => {
callback([])
});
async function getFiles(dir) {
const subdirs = await readdir(dir);
const files = await Promise.all(subdirs.map(async (subdir) => {
const res = resolve(dir, subdir);
return (await stat(res)).isDirectory() ? getFiles(res) : res;
}));
return files.reduce((a, f) => a.concat(f), []);
}
}
}
@@ -0,0 +1,35 @@
exports.newFoundationsUtilitiesHttpRequests = function () {
let thisObject = {
getRequestBody: getRequestBody
}
return thisObject
function getRequestBody(httpRequest, callback) { // Gets the de body from a POST httpRequest to the web server
try {
let body = ''
httpRequest.on('data', function (data) {
body += data
// Too much POST data
//if (body.length > 1e6) {
// httpRequest.connection.destroy()
//}
})
httpRequest.on('end', function () {
callback(body)
})
httpRequest.on('error', function (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
})
} catch (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
}
}
}
@@ -0,0 +1,215 @@
exports.newFoundationsUtilitiesHttpResponses = function () {
let thisObject = {
respondWithFile: respondWithFile,
respondWithContent: respondWithContent,
respondWithImage: respondWithImage,
respondWithFont: respondWithFont,
respondWithEmptyArray: respondWithEmptyArray,
respondWithStyleSheet: respondWithStyleSheet,
respondWithProjectFolderFileList: respondWithProjectFolderFileList,
respondWithWebFile: respondWithWebFile
}
return thisObject
function respondWithFile(fileName, httpResponse) {
let fs = SA.nodeModules.fs
if (fileName.indexOf('undefined') > 0) {
console.log('[WRN] respondWithFile -> Received httpRequest for undefined file. ')
respondWithContent(undefined, httpResponse)
} else {
try {
fs.readFile(fileName, onFileRead)
function onFileRead(err, file) {
if (!err) {
respondWithContent(file.toString(), httpResponse)
} else {
//console.log('File requested not found: ' + fileName)
respondWithContent(undefined, httpResponse)
}
}
} catch (err) {
respondWithEmptyArray(httpResponse)
}
}
}
function respondWithContent(content, httpResponse, contentType) {
try {
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
if (content !== undefined) {
if (contentType !== undefined) {
httpResponse.writeHead(200, { 'Content-Type': contentType })
} else {
httpResponse.writeHead(200, { 'Content-Type': 'text/html' })
}
httpResponse.write(content)
} else {
httpResponse.writeHead(404, { 'Content-Type': 'text/html' })
httpResponse.write('The specified key does not exist.')
}
httpResponse.end('\n')
} catch (err) {
respondWithEmptyArray(httpResponse)
}
}
function respondWithImage(fileName, httpResponse) {
let fs = SA.nodeModules.fs
fs.readFile(fileName, onFileRead)
function onFileRead(err, file) {
if (err) {
console.log('[ERROR] respondWithImage -> Image Not Found: ' + fileName + ' or Error = ' + err.stack)
return
}
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
httpResponse.writeHead(200, { 'Content-Type': 'image/png' })
httpResponse.end(file, 'binary')
}
}
function respondWithFont(fileName, httpResponse) {
let fs = SA.nodeModules.fs
fs.readFile(fileName, onFileRead)
function onFileRead(err, file) {
if (err) {
console.log('[ERROR] respondWithFont -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
return
}
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.setHeader('Access-Control-Allow-Origin', '*') // Allows to access data from other domains.
if (fileName.indexOf('2') < 0) {
httpResponse.writeHead(200, { 'Content-Type': 'font/woff' })
} else {
httpResponse.writeHead(200, { 'Content-Type': 'font/woff2' })
}
httpResponse.end(file, 'binary')
}
}
function respondWithEmptyArray(httpResponse) {
httpResponse.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') // HTTP 1.1.
httpResponse.setHeader('Pragma', 'no-cache') // HTTP 1.0.
httpResponse.setHeader('Expires', '0') // Proxies.
httpResponse.writeHead(200, { 'Content-Type': 'text/html' })
httpResponse.write('[]')
httpResponse.end('\n')
}
function respondWithStyleSheet(httpResponse, pathToApp, fileName) {
let fs = SA.nodeModules.fs
let filePath = pathToApp + '/WebServer/css/' + fileName
fs.readFile(filePath, onFileRead)
function onFileRead(err, file) {
try {
let fileContent = file.toString()
SA.projects.foundations.utilities.httpResponses.respondWithContent(fileContent, httpResponse, 'text/css')
} catch (err) {
console.log('[ERROR] respondWithStyleSheet -> File Not Found: ' + fileName + ' or Error = ' + err.stack)
}
}
}
function respondWithProjectFolderFileList(httpResponse, projectFolderName, rootObjectName) {
{
let allLibraries = []
let projects = SA.projects.foundations.utilities.filesAndDirectories.getDirectories(global.env.PATH_TO_PROJECTS)
let projectsCount = 0
for (let i = 0; i < projects.length; i++) {
let project = projects[i]
let dirPath = global.env.PATH_TO_PROJECTS + '/' + project + '/' + rootObjectName + '/' + projectFolderName
try {
let fs = SA.nodeModules.fs
fs.readdir(dirPath, onDirRead)
function onDirRead(err, fileList) {
let updatedFileList = []
if (err) {
/*
If we have a problem reading this folder we will assume that it is
because this project does not need this folder and that's it.
*/
} else {
for (let i = 0; i < fileList.length; i++) {
let name = fileList[i]
updatedFileList.push([project, name])
}
}
allLibraries = allLibraries.concat(updatedFileList)
projectsCount++
if (projectsCount === projects.length) {
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(allLibraries), httpResponse)
}
}
} catch (err) {
console.log('[ERROR] returnProjectFolderFileList -> Error reading a directory content. filePath = ' + dirPath)
console.log('[ERROR] returnProjectFolderFileList -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
return
}
}
}
}
function respondWithWebFile(httpResponse, fileNameReceived, pathToApp) {
if (fileNameReceived === '') {
/*
When there is no endpoint specidied we will respond with this app's Home Page.
*/
let fs = SA.nodeModules.fs
let fileName = pathToApp + '/WebServer/index.html'
fs.readFile(fileName, onFileRead)
function onFileRead(err, file) {
let fileContent = file.toString()
SA.projects.foundations.utilities.httpResponses.respondWithContent(fileContent, httpResponse)
}
} else {
/*
When there is a parameter but it does not match any of the available endpoints, we
will serve the file with the same name at at a location that depends on it's file extention.
*/
let completeFileName = fileNameReceived
let fileExtension = completeFileName.split('.')[1]
switch (fileExtension) {
case 'js': {
let path = pathToApp + '/UI/' + completeFileName
SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse)
break
}
case 'css': {
SA.projects.foundations.utilities.httpResponses.respondWithStyleSheet(httpResponse, pathToApp, completeFileName)
break
}
}
}
}
}
@@ -0,0 +1,15 @@
exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
let thisObject = {
genereteUniqueId: genereteUniqueId
}
return thisObject
function genereteUniqueId() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}
}
@@ -58,7 +58,7 @@ exports.newFoundationsBotModulesLearningEpisode = function (processIndex) {
/* Recording the opening at the Learning Engine Data Structure */
learningEngine.learningCurrent.learningEpisode.status.value = 'Open'
learningEngine.learningCurrent.learningEpisode.serialNumber.value = 1
learningEngine.learningCurrent.learningEpisode.identifier.value = TS.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
learningEngine.learningCurrent.learningEpisode.identifier.value = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
learningEngine.learningCurrent.learningEpisode.beginRate.value = learningEngine.learningCurrent.learningEpisode.candle.close.value
}
@@ -90,7 +90,7 @@ exports.newFoundationsBotModulesCheckWebhook = function (processIndex) {
try {
let http = require('http');
let url = 'http://' + global.env.WEB_SERVER_URL +
':' + global.env.HTTP_INTERFACE_PORT +
':' + global.env.CLIENT_HTTP_INTERFACE_PORT +
'/Webhook/Fetch-Messages/' +
TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.codeName + "/" +
TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + "-" +
@@ -66,7 +66,7 @@ exports.newFoundationsBotModulesTradingEpisode = function (processIndex) {
/* Recording the opening at the Trading Engine Data Structure */
tradingEngine.tradingCurrent.tradingEpisode.status.value = 'Open'
tradingEngine.tradingCurrent.tradingEpisode.serialNumber.value = 1
tradingEngine.tradingCurrent.tradingEpisode.identifier.value = TS.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.tradingEpisode.identifier.value = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.tradingEpisode.beginRate.value = tradingEngine.tradingCurrent.tradingEpisode.candle.close.value
}
@@ -361,7 +361,7 @@ exports.newFoundationsBotModulesTradingOrders = function (processIndex) {
/* Create Order Procedure */
tradingEngineOrder.status.value = 'Open'
tradingEngineOrder.identifier.value = TS.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngineOrder.identifier.value = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngineOrder.begin.value = tradingEngine.tradingCurrent.tradingEpisode.cycle.begin.value
tradingEngineOrder.end.value = tradingEngine.tradingCurrent.tradingEpisode.cycle.end.value
tradingEngineOrder.serialNumber.value = tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.orders.value
@@ -58,7 +58,7 @@ exports.newFoundationsBotModulesTradingPosition = function (processIndex) {
/* Recording the opening at the Trading Engine Data Structure */
tradingEngine.tradingCurrent.position.status.value = 'Open'
tradingEngine.tradingCurrent.position.serialNumber.value = tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.positions.value + 1
tradingEngine.tradingCurrent.position.identifier.value = TS.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.position.identifier.value = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.position.beginRate.value = tradingEngine.tradingCurrent.tradingEpisode.candle.close.value
tradingEngine.tradingCurrent.position.positionBaseAsset.beginBalance.value = tradingEngine.tradingCurrent.tradingEpisode.episodeBaseAsset.balance.value
tradingEngine.tradingCurrent.position.positionQuotedAsset.beginBalance.value = tradingEngine.tradingCurrent.tradingEpisode.episodeQuotedAsset.balance.value
@@ -44,7 +44,7 @@ exports.newFoundationsBotModulesTradingStrategy = function (processIndex) {
/* Recording the opening at the Trading Engine Data Structure */
tradingEngine.tradingCurrent.strategy.status.value = 'Open'
tradingEngine.tradingCurrent.strategy.serialNumber.value = tradingEngine.tradingCurrent.tradingEpisode.tradingEpisodeCounters.strategies.value
tradingEngine.tradingCurrent.strategy.identifier.value = TS.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.strategy.identifier.value = SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId()
tradingEngine.tradingCurrent.strategy.beginRate.value = tradingEngine.tradingCurrent.tradingEpisode.candle.min.value
tradingEngine.tradingCurrent.strategy.index.value = index
@@ -24,7 +24,7 @@
host = 'localhost'
}
if (port === undefined) {
port = global.env.WEB_SOCKETS_INTERFACE_PORT
port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT
}
let messageCounter = 0
@@ -1,7 +1,6 @@
exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
let thisObject = {
genereteUniqueId: genereteUniqueId,
truncateToThisPrecision: truncateToThisPrecision,
pad: pad,
asyncGetDatasetFile: asyncGetDatasetFile,
@@ -10,13 +9,6 @@ exports.newFoundationsUtilitiesMiscellaneousFunctions = function () {
return thisObject
function genereteUniqueId() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
}
function truncateToThisPrecision(floatNumber, precision) {
return parseFloat(floatNumber.toFixed(precision))
}
+46 -6
View File
@@ -894,6 +894,30 @@
"propertyName": "plugins",
"functionName": "newFoundationsUtilitiesPlugins",
"fileName": "Plugins.js"
},
{
"name": "Miscellaneous Functions",
"propertyName": "miscellaneousFunctions",
"functionName": "newFoundationsUtilitiesMiscellaneousFunctions",
"fileName": "MiscellaneousFunctions.js"
},
{
"name": "Files And Directories",
"propertyName": "filesAndDirectories",
"functionName": "newFoundationsUtilitiesFilesAndDirectories",
"fileName": "FilesAndDirectories.js"
},
{
"name": "Http Responses",
"propertyName": "httpResponses",
"functionName": "newFoundationsUtilitiesHttpResponses",
"fileName": "HttpResponses.js"
},
{
"name": "Http Requests",
"propertyName": "httpRequests",
"functionName": "newFoundationsUtilitiesHttpRequests",
"fileName": "HttpRequests.js"
}
]
},
@@ -1306,12 +1330,6 @@
"propertyName": "socialTrading",
"NT": {
"globals": [
{
"name": "Query Constants",
"propertyName": "queryConstants",
"functionName": "newSocialTradingGlobalsQueryConstants",
"fileName": "QueryConstants.js"
},
{
"name": "Memory",
"propertyName": "memory",
@@ -1431,6 +1449,28 @@
"fileName": "QueriesValidations.js"
}
]
},
"SA": {
"globals": [
{
"name": "Query Constants",
"propertyName": "queryConstants",
"functionName": "newSocialTradingGlobalsQueryConstants",
"fileName": "QueryConstants.js"
},
{
"name": "Query Types",
"propertyName": "queryTypes",
"functionName": "newSocialTradingGlobalsQueryTypes",
"fileName": "QueryTypes.js"
},
{
"name": "Event Types",
"propertyName": "eventTypes",
"functionName": "newSocialTradingGlobalsEventTypes",
"fileName": "EventTypes.js"
}
]
}
}
]
@@ -123,7 +123,7 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
let response = {
result: 'Ok',
message: 'Client Interface Event Processed.'
message: 'Client Interface Event Processed.'
}
return response
@@ -132,9 +132,11 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
Any exception that happens while trying to change the state of the Social Graph,
will be returned to the caller without doing anything else here.
*/
let errorMessage = err.message
if (errorMessage === undefined) { errorMessage = err }
let response = {
result: 'Error',
message: 'Client Interface ' + err.message
message: 'Client Interface ' + errorMessage
}
return response
}
@@ -145,7 +147,6 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
We expect here a JSON string with some or all of the following properties:
{
"equeryId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"queryType": 10,
"emitterUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
"targetUserProfileId": "a8de78f0-c3e4-4a2a-b7e8-f659073969db",
@@ -192,21 +193,23 @@ exports.newSocialTradingModulesClientInterface = function newSocialTradingModule
try {
let query = NT.projects.socialTrading.modules.query.newSocialTradingModulesQuery()
query.initialize(queryReceived)
let response = {
result: 'Ok',
message: 'Client Interface Query Processed.',
data: query.execute()
}
return response
} catch (err) {
/*
Any exception that happens while trying to execute the query.
*/
let errorMessage = err.message
if (errorMessage === undefined) { errorMessage = err }
let response = {
result: 'Error',
message: err.message
message: 'Client Interface ' + errorMessage
}
return response
}
+109 -126
View File
@@ -29,46 +29,6 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
finalize: finalize
}
const EVENT_TYPES = {
/* Users Posts and Following Events */
NEW_USER_POST: 10,
REPLY_TO_USER_POST: 11,
REPOST_USER_POST: 12,
QUOTE_REPOST_USER_POST: 13,
REMOVE_USER_POST: 14,
FOLLOW_USER_PROFILE: 15,
UNFOLLOW_USER_PROFILE: 16,
/* Bots Posts and Following Events */
NEW_BOT_POST: 20,
REPLY_TO_BOT_POST: 21,
REPOST_BOT_POST: 22,
QUOTE_REPOST_BOT_POST: 23,
REMOVE_BOT_POST: 24,
FOLLOW_BOT_PROFILE: 25,
UNFOLLOW_BOT_PROFILE: 26,
/* Bots Management Events */
ADD_BOT: 50,
REMOVE_BOT: 51,
ENABLE_BOT: 52,
DISABLE_BOT: 53,
/* Add Reaction to Posts Events */
ADD_REACTION_LIKE: 100,
ADD_REACTION_LOVE: 101,
ADD_REACTION_HAHA: 102,
ADD_REACTION_WOW: 103,
ADD_REACTION_SAD: 104,
ADD_REACTION_ANGRY: 105,
ADD_REACTION_CARE: 106,
/* Remove Reaction to Posts Events */
REMOVE_REACTION_LIKE: 200,
REMOVE_REACTION_LOVE: 201,
REMOVE_REACTION_HAHA: 202,
REMOVE_REACTION_WOW: 203,
REMOVE_REACTION_SAD: 204,
REMOVE_REACTION_ANGRY: 205,
REMOVE_REACTION_CARE: 206
}
return thisObject
function finalize() {
@@ -101,7 +61,7 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
/*
Validate Emitter User Profile.
*/
if (emitterUserProfileId === undefined) {
if (thisObject.emitterUserProfileId === undefined) {
throw ('Emitter User Profile Id Not Provided.')
}
emitterUserProfile = NT.projects.socialTrading.globals.memory.maps.USER_PROFILES_BY_ID.get(thisObject.emitterUserProfileId)
@@ -120,8 +80,8 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
/*
Validate Emitter Bot Profile.
*/
if (emitterBotProfileId !== undefined) {
emitterBotProfile = emitterUserProfile.bots.get(emitterBotProfileId)
if (thisObject.emitterBotProfileId !== undefined) {
emitterBotProfile = emitterUserProfile.bots.get(thisObject.emitterBotProfileId)
if (emitterBotProfile === undefined) {
throw ('Emitter Bot Profile Not Found.')
}
@@ -129,41 +89,52 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
/*
Validate Target Bot Profile.
*/
if (targetBotProfileId !== undefined) {
targetBotProfile = emitterUserProfile.bots.get(targetBotProfileId)
if (thisObject.targetBotProfileId !== undefined) {
targetBotProfile = emitterUserProfile.bots.get(thisObject.targetBotProfileId)
if (targetBotProfile === undefined) {
throw ('Target Bot Profile Not Found.')
}
}
postingEvents()
followingEvents()
reactionEvents()
botEvents()
eventCounters()
if (postingEvents()) {
eventCounters()
return
}
if (followingEvents()) {
eventCounters()
return
}
if (reactionEvents()) {
eventCounters()
return
}
if (botEvents()) {
eventCounters()
return
}
function postingEvents() {
/*
Is is related to Posting?
*/
if (
thisObject.eventType === EVENT_TYPES.NEW_USER_POST ||
thisObject.eventType === EVENT_TYPES.REPLY_TO_USER_POST ||
thisObject.eventType === EVENT_TYPES.REPOST_USER_POST ||
thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_USER_POST ||
thisObject.eventType === EVENT_TYPES.NEW_BOT_POST ||
thisObject.eventType === EVENT_TYPES.REPLY_TO_BOT_POST ||
thisObject.eventType === EVENT_TYPES.REPOST_BOT_POST ||
thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_BOT_POST
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPLY_TO_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPOST_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.QUOTE_REPOST_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPLY_TO_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPOST_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.QUOTE_REPOST_BOT_POST
) {
/*
New User Post
*/
if (
thisObject.eventType === EVENT_TYPES.NEW_USER_POST ||
thisObject.eventType === EVENT_TYPES.REPLY_TO_USER_POST ||
thisObject.eventType === EVENT_TYPES.REPOST_USER_POST ||
thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_USER_POST
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPLY_TO_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPOST_USER_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.QUOTE_REPOST_USER_POST
) {
emitterUserProfile.addPost(
thisObject.emitterUserProfileId,
@@ -175,16 +146,16 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
thisObject.eventType - 10,
thisObject.timestamp
)
return
return true
}
/*
New Bot Post
*/
if (
thisObject.eventType === EVENT_TYPES.NEW_BOT_POST ||
thisObject.eventType === EVENT_TYPES.REPLY_TO_BOT_POST ||
thisObject.eventType === EVENT_TYPES.REPOST_BOT_POST ||
thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_BOT_POST
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.NEW_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPLY_TO_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REPOST_BOT_POST ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.QUOTE_REPOST_BOT_POST
) {
if (emitterBotProfile === undefined) {
throw ('Emitter Bot Profile Id Not Provided.')
@@ -200,24 +171,24 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
thisObject.eventType - 20,
thisObject.timestamp
)
return
return true
}
/*
Remove User Post
*/
if (
thisObject.eventType === EVENT_TYPES.REMOVE_USER_POST
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_USER_POST
) {
emitterUserProfile.removePost(
thisObject.emitterPostHash
)
return
return true
}
/*
Remove Bot Post
*/
if (
thisObject.eventType === EVENT_TYPES.REMOVE_BOT_POST
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_BOT_POST
) {
if (emitterBotProfile === undefined) {
throw ('Emitter Bot Profile Id Not Provided.')
@@ -226,7 +197,7 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
emitterBotProfile.removePost(
thisObject.emitterPostHash
)
return
return true
}
}
}
@@ -236,13 +207,13 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
Is is a following?
*/
if (
thisObject.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE ||
thisObject.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE ||
thisObject.eventType === EVENT_TYPES.FOLLOW_BOT_PROFILE ||
thisObject.eventType === EVENT_TYPES.UNFOLLOW_BOT_PROFILE
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.FOLLOW_BOT_PROFILE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_BOT_PROFILE
) {
switch (thisObject.eventType) {
case EVENT_TYPES.FOLLOW_USER_PROFILE: {
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
if (thisObject.emitterUserProfileId === undefined) {
throw ('Emitter User Profile Id Not Provided.')
@@ -253,14 +224,14 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
}
emitterUserProfile.addFollowing(
targetUserProfileId
thisObject.targetUserProfileId
)
targetUserProfile.addFollower(
emitterUserProfileId
thisObject.emitterUserProfileId
)
break
}
case EVENT_TYPES.UNFOLLOW_USER_PROFILE: {
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
if (thisObject.emitterUserProfileId === undefined) {
throw ('Emitter User Profile Id Not Provided.')
@@ -271,14 +242,14 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
}
emitterUserProfile.removeFollowing(
targetUserProfileId
thisObject.targetUserProfileId
)
targetUserProfile.removeFollower(
emitterUserProfileId
thisObject.emitterUserProfileId
)
break
}
case EVENT_TYPES.FOLLOW_BOT_PROFILE: {
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_BOT_PROFILE: {
if (thisObject.emitterBotProfileId === undefined) {
throw ('Emitter Bot Profile Id Not Provided.')
@@ -289,16 +260,16 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
}
emitterBotProfile.addFollowing(
targetUserProfileId,
targetBotProfileId
thisObject.targetUserProfileId,
thisObject.targetBotProfileId
)
targetBotProfile.addFollower(
emitterUserProfileId,
emitterBotProfileId
thisObject.emitterUserProfileId,
thisObject.emitterBotProfileId
)
break
}
case EVENT_TYPES.UNFOLLOW_BOT_PROFILE: {
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_BOT_PROFILE: {
if (thisObject.emitterBotProfileId === undefined) {
throw ('Emitter Bot Profile Id Not Provided.')
@@ -309,15 +280,15 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
}
emitterBotProfile.removeFollowing(
targetBotProfileId
thisObject.targetBotProfileId
)
targetBotProfile.removeFollower(
emitterBotProfileId
thisObject.emitterBotProfileId
)
break
}
}
return
return true
}
}
@@ -327,39 +298,51 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
*/
let targetPost
if (targetBotProfile !== undefined) {
targetPost = targetBotProfile.posts.get(thisObject.targetPostHash)
} else {
targetPost = targetUserProfile.posts.get(thisObject.targetPostHash)
}
if (targetPost === undefined) {
throw ('Target Post Not Found')
}
if (
thisObject.eventType === EVENT_TYPES.ADD_REACTION_LIKE ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_LOVE ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_HAHA ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_WOW ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_SAD ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_ANGRY ||
thisObject.eventType === EVENT_TYPES.ADD_REACTION_CARE
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_LIKE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_LOVE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_HAHA ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_WOW ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_SAD ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_ANGRY ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_REACTION_CARE
) {
if (targetBotProfile !== undefined) {
targetPost = targetBotProfile.posts.get(thisObject.targetPostHash)
} else {
targetPost = targetUserProfile.posts.get(thisObject.targetPostHash)
}
if (targetPost === undefined) {
throw ('Target Post Not Found')
}
targetPost.addReaction(thisObject.eventType - 100)
return
return true
}
if (
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_LIKE ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_LOVE ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_HAHA ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_WOW ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_SAD ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_ANGRY ||
thisObject.eventType === EVENT_TYPES.REMOVE_REACTION_CARE
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_LIKE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_LOVE ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_HAHA ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_WOW ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_SAD ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_ANGRY ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_REACTION_CARE
) {
if (targetBotProfile !== undefined) {
targetPost = targetBotProfile.posts.get(thisObject.targetPostHash)
} else {
targetPost = targetUserProfile.posts.get(thisObject.targetPostHash)
}
if (targetPost === undefined) {
throw ('Target Post Not Found')
}
targetPost.removeReaction(thisObject.eventType - 200)
return
return true
}
}
@@ -368,13 +351,13 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
Is is a Bot?
*/
if (
thisObject.eventType === EVENT_TYPES.ADD_BOT ||
thisObject.eventType === EVENT_TYPES.REMOVE_BOT ||
thisObject.eventType === EVENT_TYPES.ENABLE_BOT ||
thisObject.eventType === EVENT_TYPES.DISABLE_BOT
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ADD_BOT ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.REMOVE_BOT ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.ENABLE_BOT ||
thisObject.eventType === SA.projects.socialTrading.globals.eventTypes.DISABLE_BOT
) {
switch (thisObject.eventType) {
case EVENT_TYPES.ADD_BOT: {
case SA.projects.socialTrading.globals.eventTypes.ADD_BOT: {
emitterUserProfile.addBot(
thisObject.emitterUserProfileId,
thisObject.emitterBotProfileId,
@@ -384,26 +367,26 @@ exports.newSocialTradingModulesEvent = function newSocialTradingModulesEvent() {
)
break
}
case EVENT_TYPES.REMOVE_BOT: {
case SA.projects.socialTrading.globals.eventTypes.REMOVE_BOT: {
emitterUserProfile.removeBot(
thisObject.emitterBotProfileId
)
break
}
case EVENT_TYPES.ENABLE_BOT: {
case SA.projects.socialTrading.globals.eventTypes.ENABLE_BOT: {
emitterUserProfile.enableBot(
thisObject.emitterBotProfileId
)
break
}
case EVENT_TYPES.DISABLE_BOT: {
case SA.projects.socialTrading.globals.eventTypes.DISABLE_BOT: {
emitterUserProfile.disableBot(
thisObject.emitterBotProfileId
)
break
}
}
return
return true
}
}
@@ -29,7 +29,7 @@ exports.newSocialTradingModulesQueriesEvents = function newSocialTradingModulesQ
function execute() {
let response = []
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.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.newSocialTradingModulesQueriesEvents = function newSocialTradingModulesQ
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.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 }
@@ -43,7 +43,7 @@ exports.newSocialTradingModulesQueriesPostReplies = function newSocialTradingMod
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (post === undefined) { break }
@@ -51,7 +51,7 @@ exports.newSocialTradingModulesQueriesPostReplies = function newSocialTradingMod
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (post === undefined) { break }
@@ -35,7 +35,7 @@ exports.newSocialTradingModulesQueriesProfileFollowers = function newSocialTradi
let response = []
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -35,7 +35,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
let response = []
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -43,7 +43,7 @@ exports.newSocialTradingModulesQueriesProfileFollowing = function newSocialTradi
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -38,7 +38,7 @@ exports.newSocialTradingModulesQueriesUserProfileStats = function newSocialTradi
let response = []
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -46,7 +46,7 @@ exports.newSocialTradingModulesQueriesUserProfileStats = function newSocialTradi
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -37,7 +37,7 @@ exports.newSocialTradingModulesQueriesUserProfiles = function newSocialTradingMo
let response = []
switch (thisObject.direction) {
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE: {
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
@@ -45,7 +45,7 @@ exports.newSocialTradingModulesQueriesUserProfiles = function newSocialTradingMo
}
break
}
case NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
case SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST: {
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
let arrayItem = thisObject.array[i]
if (arrayItem === undefined) { break }
+8 -21
View File
@@ -15,19 +15,6 @@ exports.newSocialTradingModulesQuery = function newSocialTradingModulesQuery() {
finalize: finalize
}
const QUERY_TYPES = {
USER_PROFILES: 0,
USER_PROFILE_STATS: 1,
BOT_PROFILE_STATS: 2,
PROFILE_POSTS: 3,
PROFILE_FOLLOWERS: 4,
PROFILE_FOLLOWING: 5,
POST_REPLIES: 6,
EVENTS: 7
}
return thisObject
function finalize() {
@@ -41,49 +28,49 @@ exports.newSocialTradingModulesQuery = function newSocialTradingModulesQuery() {
switch (thisObject.queryType) {
case QUERY_TYPES.USER_PROFILES: {
case SA.projects.socialTrading.globals.queryTypes.USER_PROFILES: {
thisObject.query = NT.projects.socialTrading.modules.queriesUserProfiles.newSocialTradingModulesQueriesUserProfiles()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.USER_PROFILE_STATS: {
case SA.projects.socialTrading.globals.queryTypes.USER_PROFILE_STATS: {
thisObject.query = NT.projects.socialTrading.modules.queriesUserProfileStats.newSocialTradingModulesQueriesUserProfileStats()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.BOT_PROFILE_STATS: {
case SA.projects.socialTrading.globals.queryTypes.BOT_PROFILE_STATS: {
thisObject.query = NT.projects.socialTrading.modules.queriesBotProfileStats.newSocialTradingModulesQueriesBotProfileStats()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.PROFILE_POSTS: {
case SA.projects.socialTrading.globals.queryTypes.PROFILE_POSTS: {
thisObject.query = NT.projects.socialTrading.modules.queriesProfilePosts.newSocialTradingModulesQueriesProfilePosts()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.POST_REPLIES: {
case SA.projects.socialTrading.globals.queryTypes.POST_REPLIES: {
thisObject.query = NT.projects.socialTrading.modules.queriesPostReplies.newSocialTradingModulesQueriesPostReplies()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.PROFILE_FOLLOWERS: {
case SA.projects.socialTrading.globals.queryTypes.PROFILE_FOLLOWERS: {
thisObject.query = NT.projects.socialTrading.modules.queriesProfileFollowers.newSocialTradingModulesQueriesProfileFollowers()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.PROFILE_FOLLOWING: {
case SA.projects.socialTrading.globals.queryTypes.PROFILE_FOLLOWING: {
thisObject.query = NT.projects.socialTrading.modules.queriesProfileFollowing.newSocialTradingModulesQueriesProfileFollowing()
thisObject.query.initialize(queryReceived)
break
}
case QUERY_TYPES.maps.EVENTS: {
case SA.projects.socialTrading.globals.queryTypes.maps.EVENTS: {
thisObject.query = NT.projects.socialTrading.modules.queriesEvents.newSocialTradingModulesQueriesEvents()
thisObject.query.initialize(queryReceived)
break
@@ -51,11 +51,11 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
throw ('Initial Index Undefined.')
}
if (queryReceived.initialIndex === NT.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST) {
if (queryReceived.initialIndex === SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST) {
queryReceived.initialIndex = array.length - 1
}
if (queryReceived.initialIndex === NT.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST) {
if (queryReceived.initialIndex === SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST) {
queryReceived.initialIndex = 0
}
@@ -75,11 +75,11 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
throw ('Amount Requested Is Not a Number.')
}
if (queryReceived.amountRequested < NT.projects.socialTrading.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
if (queryReceived.amountRequested < SA.projects.socialTrading.globals.queryConstants.MIN_AMOUNT_REQUESTED) {
throw ('Amount Requested Below Min.')
}
if (queryReceived.amountRequested > NT.projects.socialTrading.globals.queryConstants.MAX_AMOUNT_REQUESTED) {
if (queryReceived.amountRequested > SA.projects.socialTrading.globals.queryConstants.MAX_AMOUNT_REQUESTED) {
throw ('Amount Requested Above Max.')
}
@@ -91,7 +91,7 @@ exports.newSocialTradingUtilitiesQueriesValidations = function newSocialTradingU
throw ('Direction Undefined.')
}
if (queryReceived.direction !== NT.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== NT.projects.socialTrading.globals.queryConstants.DIRECTION_PAST) {
if (queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_FUTURE && queryReceived.direction !== SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST) {
throw ('Direction Not Supported.')
}
@@ -0,0 +1,44 @@
exports.newSocialTradingGlobalsEventTypes = function () {
let thisObject = {
/* Users Posts and Following Events */
NEW_USER_POST: 10,
REPLY_TO_USER_POST: 11,
REPOST_USER_POST: 12,
QUOTE_REPOST_USER_POST: 13,
REMOVE_USER_POST: 14,
FOLLOW_USER_PROFILE: 15,
UNFOLLOW_USER_PROFILE: 16,
/* Bots Posts and Following Events */
NEW_BOT_POST: 20,
REPLY_TO_BOT_POST: 21,
REPOST_BOT_POST: 22,
QUOTE_REPOST_BOT_POST: 23,
REMOVE_BOT_POST: 24,
FOLLOW_BOT_PROFILE: 25,
UNFOLLOW_BOT_PROFILE: 26,
/* Bots Management Events */
ADD_BOT: 50,
REMOVE_BOT: 51,
ENABLE_BOT: 52,
DISABLE_BOT: 53,
/* Add Reaction to Posts Events */
ADD_REACTION_LIKE: 100,
ADD_REACTION_LOVE: 101,
ADD_REACTION_HAHA: 102,
ADD_REACTION_WOW: 103,
ADD_REACTION_SAD: 104,
ADD_REACTION_ANGRY: 105,
ADD_REACTION_CARE: 106,
/* Remove Reaction to Posts Events */
REMOVE_REACTION_LIKE: 200,
REMOVE_REACTION_LOVE: 201,
REMOVE_REACTION_HAHA: 202,
REMOVE_REACTION_WOW: 203,
REMOVE_REACTION_SAD: 204,
REMOVE_REACTION_ANGRY: 205,
REMOVE_REACTION_CARE: 206
}
return thisObject
}
@@ -0,0 +1,15 @@
exports.newSocialTradingGlobalsQueryTypes = function () {
let thisObject = {
USER_PROFILES: 0,
USER_PROFILE_STATS: 1,
BOT_PROFILE_STATS: 2,
PROFILE_POSTS: 3,
PROFILE_FOLLOWERS: 4,
PROFILE_FOLLOWING: 5,
POST_REPLIES: 6,
EVENTS: 7
}
return thisObject
}