refactoring schemaDocument

This commit is contained in:
Luis Fernando Molina committed 2020-12-18 10:21:50 +01:00
1 parent c71b8efd05
commit 50a2bfc6b9
40 files changed
+370 -370

No files matched your search

+2 -2
View File
@@ -931,8 +931,8 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
for (let k = 0; k < fileList.length; k++) {
let name = fileList[k]
let fileContent = fs.readFileSync(filePath + '/' + folder + '/' + name)
let nodeDefinition = JSON.parse(fileContent)
schemaArray.push(nodeDefinition)
let schemaDocument = JSON.parse(fileContent)
schemaArray.push(schemaDocument)
}
let schema = JSON.stringify(schemaArray)
respondWithContent(schema, httpResponse)
@@ -24,7 +24,7 @@
},
{
"style": "Note",
"text": "See the data dependency node definition and the Adding a Data Dependecy Node section for all the details."
"text": "See the data dependency schema document and the Adding a Data Dependecy Node section for all the details."
},
{
"style": "Title",
@@ -28,7 +28,7 @@
},
{
"style": "Note",
"text": "See the data product node definition and the Adding a Data Product Node section for all the details."
"text": "See the data product schema document and the Adding a Data Product Node section for all the details."
},
{
"style": "Title",
@@ -24,7 +24,7 @@
},
{
"style": "Note",
"text": "See the data dependency node definition and the Adding a Data Dependecy Node section for all the details."
"text": "See the data dependency schema document and the Adding a Data Dependecy Node section for all the details."
},
{
"style": "Title",
@@ -28,7 +28,7 @@
},
{
"style": "Note",
"text": "See the data product node definition and the Adding a Data Product Node section for all the details."
"text": "See the data product schema document and the Adding a Data Product Node section for all the details."
},
{
"style": "Title",
@@ -24,7 +24,7 @@
},
{
"style": "Note",
"text": "See the task node definition and the Adding a Task Node section for all the details."
"text": "See the task schema document and the Adding a Task Node section for all the details."
},
{
"style": "Title",
@@ -32,7 +32,7 @@
},
{
"style": "Note",
"text": "See the data product node definition and the Adding a Data Product Node section for all the details."
"text": "See the data product schema document and the Adding a Data Product Node section for all the details."
},
{
"style": "Title",
@@ -24,7 +24,7 @@
},
{
"style": "Note",
"text": "See the task node definition and the Adding a Task Node section for all the details."
"text": "See the task schema document and the Adding a Task Node section for all the details."
},
{
"style": "Title",
@@ -124,13 +124,13 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
}
/* Now we go down through all this node children */
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -112,13 +112,13 @@ exports.newSuperalgosBotModulesTradingEngine = function (processIndex) {
destinationNode.value = originNode.value
/* Now we go down through all the children of the origin node, assuming the destination node has the same children structure*/
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(originNode.project + '-' + originNode.type)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -151,13 +151,13 @@ exports.newSuperalgosBotModulesTradingEngine = function (processIndex) {
nodesMap.set(node.id, node)
/* Now we go down through all this node children */
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -194,13 +194,13 @@ exports.newSuperalgosBotModulesTradingEngine = function (processIndex) {
}
/* Now we go down through all this node children */
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -202,13 +202,13 @@ exports.newSuperalgosBotModulesTradingSystem = function (processIndex) {
}
/* Now we go down through all this node children */
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(node.project + '-' + node.type)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -16,17 +16,17 @@ exports.newSuperalgosUtilitiesNodeFunctions = function () {
return resultArray
function scanNodeBranch(startingNode) {
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.type === nodeType) {
resultArray.push(startingNode)
return
}
if (nodeDefinition.childrenNodesProperties === undefined) { return }
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties === undefined) { return }
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -60,8 +60,8 @@ exports.newSuperalgosUtilitiesNodeFunctions = function () {
if (startingNode === undefined) { return }
if (nodeFound !== undefined) { return }
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.type === nodeType) {
nodeFound = startingNode
@@ -69,9 +69,9 @@ exports.newSuperalgosUtilitiesNodeFunctions = function () {
}
/* We scan through this node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -114,8 +114,8 @@ exports.newSuperalgosUtilitiesNodeFunctions = function () {
function scanNodeMesh(startingNode) {
if (startingNode === undefined) { return }
let nodeDefinition = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (nodeDefinition === undefined) { return }
let schemaDocument = TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.get(startingNode.project + '-' + startingNode.type)
if (schemaDocument === undefined) { return }
if (startingNode.id === nodeId) {
nodeArray.push(startingNode)
@@ -123,9 +123,9 @@ exports.newSuperalgosUtilitiesNodeFunctions = function () {
}
/* We scan through this node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -632,7 +632,7 @@ function newSuperalgosActionSwitch() {
break
case 'Open Documentation':
{
let definition = getNodeDefinition(action.node)
let definition = getSchemaDocument(action.node)
if (definition !== undefined) {
UI.projects.superalgos.spaces.docsSpace.openSpaceAreaAndNavigateTo('Node', action.node.type, action.node.project)
}
@@ -31,16 +31,16 @@ function newSuperalgosFunctionLibraryChainAttachDetach() {
return
}
default: {
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
/* Detach from parent */
if (node.payload.parentNode !== undefined) {
let parentNodeDefinition = getNodeDefinition(node.payload.parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
if (nodeDefinition.propertyNameAtParent === property.name) {
let parentSchemaDocument = getSchemaDocument(node.payload.parentNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (schemaDocument.propertyNameAtParent === property.name) {
switch (property.type) {
case 'node': {
node.payload.parentNode[property.name] = undefined
@@ -166,18 +166,18 @@ function newSuperalgosFunctionLibraryChainAttachDetach() {
}
break
default: {
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
node.payload.parentNode = attachToNode
node.payload.chainParent = attachToNode
/* Attach to new parent */
if (node.payload.parentNode !== undefined) {
let parentNodeDefinition = getNodeDefinition(node.payload.parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
if (nodeDefinition.propertyNameAtParent === property.name) {
let parentSchemaDocument = getSchemaDocument(node.payload.parentNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (schemaDocument.propertyNameAtParent === property.name) {
switch (property.type) {
case 'node': {
node.payload.parentNode[property.name] = node
@@ -656,11 +656,11 @@ function newSuperalgosFunctionLibraryCryptoEcosystemFunctions() {
delete the project reference.
*/
let projectReference = dashboard.payload.parentNode
nodeDefinition = getNodeDefinition(dashboard)
schemaDocument = getSchemaDocument(dashboard)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(dashboard, rootNodes)
if (projectReference !== undefined && nodeDefinition.propertyNameAtParent !== undefined) {
if (projectReference[nodeDefinition.propertyNameAtParent] !== undefined) {
if (projectReference[nodeDefinition.propertyNameAtParent].length === 0) {
if (projectReference !== undefined && schemaDocument.propertyNameAtParent !== undefined) {
if (projectReference[schemaDocument.propertyNameAtParent] !== undefined) {
if (projectReference[schemaDocument.propertyNameAtParent].length === 0) {
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(projectReference, rootNodes)
}
}
@@ -704,19 +704,19 @@ function newSuperalgosFunctionLibraryCryptoEcosystemFunctions() {
delete the exchange reference.
*/
let exchangeReference = marketReference.payload.parentNode
let nodeDefinition = getNodeDefinition(marketReference)
let schemaDocument = getSchemaDocument(marketReference)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(marketReference, rootNodes)
if (exchangeReference !== undefined && nodeDefinition.propertyNameAtParent !== undefined) {
if (exchangeReference[nodeDefinition.propertyNameAtParent].length === 0) {
if (exchangeReference !== undefined && schemaDocument.propertyNameAtParent !== undefined) {
if (exchangeReference[schemaDocument.propertyNameAtParent].length === 0) {
/*
If possible, after we delete the exchange reference, we will also
delete the project reference.
*/
let projectReference = exchangeReference.payload.parentNode
nodeDefinition = getNodeDefinition(exchangeReference)
schemaDocument = getSchemaDocument(exchangeReference)
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(exchangeReference, rootNodes)
if (projectReference !== undefined && nodeDefinition.propertyNameAtParent !== undefined) {
if (projectReference[nodeDefinition.propertyNameAtParent].length === 0) {
if (projectReference !== undefined && schemaDocument.propertyNameAtParent !== undefined) {
if (projectReference[schemaDocument.propertyNameAtParent].length === 0) {
UI.projects.superalgos.functionLibraries.nodeDeleter.deleteUIObject(projectReference, rootNodes)
}
}
@@ -14,12 +14,12 @@ function newSuperalgosFunctionLibraryDependenciesFilter() {
function recursiveFilter(node) {
filter(node.code)
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.childrenNodesProperties !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -14,13 +14,13 @@ function newNodeChildren() {
childrenCount: 0,
childIndex: undefined
}
let parentNodeDefinition = getNodeDefinition(parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
let parentSchemaDocument = getSchemaDocument(parentNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (parentNode[property.name] !== undefined) {
switch (property.type) {
case 'node': {
@@ -34,12 +34,12 @@ function newNodeChildren() {
}
break
case 'array': {
let nodeDefinition = getNodeDefinition(childNode)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(childNode)
if (schemaDocument !== undefined) {
let nodePropertyArray = parentNode[property.name]
for (let j = 0; j < nodePropertyArray.length; j++) {
let child = nodePropertyArray[j]
if (nodeDefinition.chainedToSameType === true) {
if (schemaDocument.chainedToSameType === true) {
if (j < 1) {
response.childrenCount++
if (child.id === childNode.id) {
@@ -19,8 +19,8 @@ function newSuperalgosFunctionLibraryNodeCloning() {
function cloneNode(node) {
if (node === undefined) { return }
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
let object = {
type: node.type,
name: node.name,
@@ -30,10 +30,10 @@ function newSuperalgosFunctionLibraryNodeCloning() {
}
/* Children Nodes */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -73,8 +73,8 @@ function newSuperalgosFunctionLibraryNodeCloning() {
function redirectReferenceParents(node) {
if (node === undefined) { return }
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
let object = {
type: node.type,
name: node.name,
@@ -84,10 +84,10 @@ function newSuperalgosFunctionLibraryNodeCloning() {
}
/* Children Nodes */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -31,13 +31,13 @@ function newSuperalgosFunctionLibraryNodeDeleter() {
node.payload.referenceParent.payload.uiObject.isShowing = false
}
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
/* Remove all of its own children nodes. */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -65,16 +65,16 @@ function newSuperalgosFunctionLibraryNodeDeleter() {
}
/* Remove node from parent */
if (nodeDefinition.propertyNameAtParent !== undefined) {
if (schemaDocument.propertyNameAtParent !== undefined) {
let removedFromParent = false
if (node.payload !== undefined) {
if (node.payload.parentNode !== undefined) {
let parentNodeDefinition = getNodeDefinition(node.payload.parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
if (nodeDefinition.propertyNameAtParent === property.name) {
let parentSchemaDocument = getSchemaDocument(node.payload.parentNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (schemaDocument.propertyNameAtParent === property.name) {
switch (property.type) {
case 'node': {
node.payload.parentNode[property.name] = undefined
@@ -88,7 +88,7 @@ function newSuperalgosFunctionLibraryNodeDeleter() {
let arrayItem = nodePropertyArray[j]
if (arrayItem.id === node.id) {
/* If this object is chained to the ones of the same type we need to give the next in the chain the reference to the current chain parent */
if (nodeDefinition.chainedToSameType === true) {
if (schemaDocument.chainedToSameType === true) {
if (j < nodePropertyArray.length - 1) {
let nextArrayItem = nodePropertyArray[j + 1]
nextArrayItem.payload.chainParent = node.payload.chainParent
@@ -108,7 +108,7 @@ function newSuperalgosFunctionLibraryNodeDeleter() {
}
}
if (removedFromParent === false) {
console.log('[ERROR] Deleting Node: ' + node.type + ' ' + node.name + '. This node could not be deleted from its parent node (' + node.payload.parentNode.type + ') because its configured propertyNameAtParent (' + nodeDefinition.propertyNameAtParent + ') does not match any of the properties of its parent.')
console.log('[ERROR] Deleting Node: ' + node.type + ' ' + node.name + '. This node could not be deleted from its parent node (' + node.payload.parentNode.type + ') because its configured propertyNameAtParent (' + schemaDocument.propertyNameAtParent + ') does not match any of the properties of its parent.')
return false
}
}
@@ -18,12 +18,12 @@ function newSuperalgosFunctionLibraryNodePath() {
if (node.payload === undefined) { return }
if (node.payload.parentNode === undefined) { return }
let nodeDefinition = getNodeDefinition(node.payload.parentNode)
if (nodeDefinition === undefined) { return }
if (nodeDefinition.childrenNodesProperties === undefined) { return }
let schemaDocument = getSchemaDocument(node.payload.parentNode)
if (schemaDocument === undefined) { return }
if (schemaDocument.childrenNodesProperties === undefined) { return }
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
let parentProperty = node.payload.parentNode[property.name]
if (parentProperty === undefined) { continue }
@@ -7,8 +7,8 @@ function newSuperalgosFunctionLibraryOnFocus() {
function getNodeThatIsOnFocus(node) {
if (node === undefined || node === null) { return }
if (node.payload === undefined) { return }
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
/* First we ask the question to ourself */
if (node.payload.uiObject.isOnFocus === true) {
return node
@@ -16,10 +16,10 @@ function newSuperalgosFunctionLibraryOnFocus() {
/* Then we check all of its own children nodes. */
if (node.payload.floatingObject.isCollapsed !== true) {
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -13,9 +13,9 @@ function newSuperalgosFunctionLibraryProtocolNode() {
if (node === undefined) { return }
if (node.payload === undefined) { return }
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
if (removePersonalData === true && nodeDefinition.isPersonalData === true) { return }
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
if (removePersonalData === true && schemaDocument.isPersonalData === true) { return }
let object = {
type: node.type,
name: node.name,
@@ -25,9 +25,9 @@ function newSuperalgosFunctionLibraryProtocolNode() {
}
/* Children Nodes */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -90,8 +90,8 @@ function newSuperalgosFunctionLibraryProtocolNode() {
}
}
if (parseConfig && object.config !== undefined && nodeDefinition.editors !== undefined) {
if (nodeDefinition.editors.config === true) {
if (parseConfig && object.config !== undefined && schemaDocument.editors !== undefined) {
if (schemaDocument.editors.config === true) {
try {
object.config = JSON.parse(node.config)
} catch (err) {
@@ -6,8 +6,8 @@ function newSuperalgosFunctionLibraryShortcutKeys() {
function getNodeByShortcutKey(node, searchingKey) {
if (node === undefined) { return }
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
/* Check Self first */
if (node.payload.uiObject.shortcutKey === searchingKey) {
return node
@@ -15,10 +15,10 @@ function newSuperalgosFunctionLibraryShortcutKeys() {
/* Check all of its own children nodes. */
if (node.payload.floatingObject.isCollapsed !== true) {
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -18,7 +18,7 @@ function newSuperalgosFunctionLibrarySuperScriptsFunctions() {
if (exchange === undefined) {
UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.createUiObjectFromNode(templateClone, target, target)
} else {
let definition = getNodeDefinition(target)
let definition = getSchemaDocument(target)
for (let i = 0; i < definition.childrenNodesProperties.length; i++) {
let property = definition.childrenNodesProperties[i]
if (property.childType === exchangeNodeType) {
@@ -219,10 +219,10 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
}
}
function migrateCodeToConfig(node, nodeDefinition) {
function migrateCodeToConfig(node, schemaDocument) {
/* Code needed to Migrante from Beta 5 to Beta a Workspace */
if (nodeDefinition.editors !== undefined) {
if (nodeDefinition.editors.config === true) {
if (schemaDocument.editors !== undefined) {
if (schemaDocument.editors.config === true) {
if (node.code !== undefined) {
node.config = node.code
node.code = undefined
@@ -248,33 +248,33 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
}
/* Get node definition */
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition !== undefined) {
migrateCodeToConfig(node, nodeDefinition)
/* Get schema document */
let schemaDocument = getSchemaDocument(node)
if (schemaDocument !== undefined) {
migrateCodeToConfig(node, schemaDocument)
/* Resolve Initial Values */
if (nodeDefinition.initialValues !== undefined) {
if (nodeDefinition.initialValues.code !== undefined) {
if (schemaDocument.initialValues !== undefined) {
if (schemaDocument.initialValues.code !== undefined) {
if (node.code === undefined) {
node.code = nodeDefinition.initialValues.code
node.code = schemaDocument.initialValues.code
}
}
if (nodeDefinition.initialValues.config !== undefined) {
if (schemaDocument.initialValues.config !== undefined) {
if (node.config === undefined) {
node.config = nodeDefinition.initialValues.config
node.config = schemaDocument.initialValues.config
}
}
}
/* For the cases where an node is not chained to its parent but to the one at the parent before it at its collection */
if (nodeDefinition.chainedToSameType === true) {
if (schemaDocument.chainedToSameType === true) {
if (parentNode !== undefined) {
let parentNodeDefinition = getNodeDefinition(parentNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
let parentSchemaDocument = getSchemaDocument(parentNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (property.childType === node.type) {
if (property.type === 'array') {
if (parentNode[property.name] !== undefined) {
@@ -300,10 +300,10 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
createUiObject(false, node.type, node.name, node, parentNode, chainParent, node.type, positionOffset)
/* Create Children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (node[property.name] !== undefined) {
switch (property.type) {
case 'node': {
@@ -341,28 +341,28 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
project: project
}
let parentNodeDefinition
let parentSchemaDocument
/* Resolve Initial Values */
let nodeDefinition = getNodeDefinition(object, project)
let schemaDocument = getSchemaDocument(object, project)
if (nodeDefinition === undefined) {
if (schemaDocument === undefined) {
console.log('Cannot addUIOBject of ' + type + ' because that type it is not defined at the APP_SCHEMA.')
return
}
if (nodeDefinition.initialValues !== undefined) {
if (nodeDefinition.initialValues.code !== undefined) {
object.code = nodeDefinition.initialValues.code
if (schemaDocument.initialValues !== undefined) {
if (schemaDocument.initialValues.code !== undefined) {
object.code = schemaDocument.initialValues.code
}
}
if (nodeDefinition.initialValues !== undefined) {
if (nodeDefinition.initialValues.config !== undefined) {
object.config = nodeDefinition.initialValues.config
if (schemaDocument.initialValues !== undefined) {
if (schemaDocument.initialValues.config !== undefined) {
object.config = schemaDocument.initialValues.config
}
}
let chainParent = parentNode
if (nodeDefinition.isHierarchyHead === true || nodeDefinition.isProjectHead) {
if (schemaDocument.isHierarchyHead === true || schemaDocument.isProjectHead) {
rootNodes.push(object)
initializeArrayProperties()
applyInitialValues()
@@ -372,8 +372,8 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
} else {
parentNodeDefinition = getNodeDefinition(parentNode, parentNode.project)
if (parentNodeDefinition === undefined) {
parentSchemaDocument = getSchemaDocument(parentNode, parentNode.project)
if (parentSchemaDocument === undefined) {
console.log('Cannot addUIOBject from parent of ' + type + ' because that type it is not defined at the APP_SCHEMA.')
return
}
@@ -389,10 +389,10 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
function checkChainToSelfTypeCollection() {
/* For the cases where a node is not chained to its parent but to the one at the parent before it at its own collection */
if (nodeDefinition.chainedToSameType === true) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
if (schemaDocument.chainedToSameType === true) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (property.childType === type) {
if (property.type === 'array') {
if (parentNode[property.name] !== undefined) {
@@ -410,9 +410,9 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
function initializeArrayProperties() {
/* Create Empty Arrays for properties of type Array */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (property.type === 'array') {
object[property.name] = []
}
@@ -421,22 +421,22 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
}
function applyInitialValues() {
if (nodeDefinition.initialValues !== undefined) {
if (nodeDefinition.initialValues.code !== undefined) {
object.code = nodeDefinition.initialValues.code
if (schemaDocument.initialValues !== undefined) {
if (schemaDocument.initialValues.code !== undefined) {
object.code = schemaDocument.initialValues.code
}
if (nodeDefinition.initialValues.config !== undefined) {
object.config = nodeDefinition.initialValues.config
if (schemaDocument.initialValues.config !== undefined) {
object.config = schemaDocument.initialValues.config
}
}
}
function connectToParent() {
/* Connect to Parent */
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < parentNodeDefinition.childrenNodesProperties.length; i++) {
let property = parentNodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < parentSchemaDocument.childrenNodesProperties.length; i++) {
let property = parentSchemaDocument.childrenNodesProperties[i]
if (property.childType === type) {
switch (property.type) {
case 'node': {
@@ -469,10 +469,10 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
function autoAddChildren() {
/* Auto Add more Children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -502,13 +502,13 @@ function newSuperalgosFunctionLibraryUiObjectsFromNodes() {
}
function addMissingChildren(node, rootNodes) {
let nodeDefinition = getNodeDefinition(node)
let schemaDocument = getSchemaDocument(node)
/* Connect to Parent */
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (property.type === 'node') {
if (property.name !== previousPropertyName) {
if (node[property.name] === undefined) {
@@ -42,15 +42,15 @@ function newSuperalgosDesignSpace() {
let project = PROJECTS_ARRAY[i]
let appSchema = SCHEMAS_BY_PROJECT.get(project).array.appSchema
for (let j = 0; j < appSchema.length; j++) {
let nodeDefinition = appSchema[j]
let iconName = nodeDefinition.icon
let schemaDocument = appSchema[j]
let iconName = schemaDocument.icon
if (iconName === undefined) {
iconName = nodeDefinition.type.toLowerCase()
iconName = schemaDocument.type.toLowerCase()
iconName = iconName.split(" ").join("-")
}
let icon = thisObject.getIconByProjectAndName(project, iconName)
if (icon !== undefined) {
let key = project + '-' + nodeDefinition.type
let key = project + '-' + schemaDocument.type
thisObject.iconsByProjectAndType.set(key, icon)
}
}
@@ -382,9 +382,9 @@ function newWorkspace() {
let nodes = []
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
let nodeDefinition = getNodeDefinition(rootNode)
if (nodeDefinition !== undefined) {
if (nodeDefinition.isHierarchyHead === true) {
let schemaDocument = getSchemaDocument(rootNode)
if (schemaDocument !== undefined) {
if (schemaDocument.isHierarchyHead === true) {
nodes.push(rootNode)
}
}
@@ -396,9 +396,9 @@ function newWorkspace() {
let nodes = []
for (let i = 0; i < thisObject.workspaceNode.rootNodes.length; i++) {
let rootNode = thisObject.workspaceNode.rootNodes[i]
let nodeDefinition = getNodeDefinition(rootNode)
if (nodeDefinition !== undefined) {
if (nodeDefinition.isProjectHead === true) {
let schemaDocument = getSchemaDocument(rootNode)
if (schemaDocument !== undefined) {
if (schemaDocument.isProjectHead === true) {
nodes.push(rootNode)
}
}
@@ -53,8 +53,8 @@ function newSuperalgosDocSpace() {
browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
setUpContextMenu()
setUpMenuItemsMap()
//setUpWorkspaceSchemas()
setUpSearchEngine()
setUpWorkspaceSchemas()
isInitialized = true
function setUpContextMenu() {
@@ -251,11 +251,11 @@ function newSuperalgosDocSpace() {
let appSchemaArray = SCHEMAS_BY_PROJECT.get(project).array.appSchema
for (let j = 0; j < appSchemaArray.length; j++) {
let nodeDefinition = appSchemaArray[j]
let schemaDocument = appSchemaArray[j]
if (nodeDefinition.menuItems === undefined) { continue }
for (let k = 0; k < nodeDefinition.menuItems.length; k++) {
let menuItem = nodeDefinition.menuItems[k]
if (schemaDocument.menuItems === undefined) { continue }
for (let k = 0; k < schemaDocument.menuItems.length; k++) {
let menuItem = schemaDocument.menuItems[k]
menuLabelsMap.set(menuItem.label, true)
}
}
@@ -285,39 +285,39 @@ function newSuperalgosDocSpace() {
for (let i = 0; i < allNodesFound.length; i++) {
let node = allNodesFound[i]
if (node.project === project) {
let document = {
let schemaDocument = {
type: node.type,
definition: node.name,
paragraphs: []
}
if (node.config !== undefined) {
let paragraph
let paragraph
paragraph = {
style: "Subtitle",
text: "Config"
}
document.paragraphs.push(paragraph)
schemaDocument.paragraphs.push(paragraph)
paragraph = {
syle: "Json",
text: node.config
}
document.paragraphs.push(paragraph)
schemaDocument.paragraphs.push(paragraph)
}
if (node.code !== undefined) {
let paragraph
let paragraph
paragraph = {
style: "Subtitle",
text: "Code"
}
document.paragraphs.push(paragraph)
schemaDocument.paragraphs.push(paragraph)
paragraph = {
syle: "Javascript",
text: node.code
}
document.paragraphs.push(paragraph)
schemaDocument.paragraphs.push(paragraph)
}
}
SCHEMAS_BY_PROJECT.get(project).array.workspaceNodeSchema.push(document)
SCHEMAS_BY_PROJECT.get(project).array.workspaceNodeSchema.push(schemaDocument)
}
}
}
@@ -332,7 +332,7 @@ function newSuperalgosDocSpace() {
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
document: SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema[i],
schemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsNodeSchema[i],
documentCategory: 'Node',
project: project
}
@@ -343,7 +343,7 @@ function newSuperalgosDocSpace() {
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
document: SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema[i],
schemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsConceptSchema[i],
documentCategory: 'Concept',
project: project
}
@@ -354,7 +354,7 @@ function newSuperalgosDocSpace() {
for (let i = 0; i < SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema.length; i++) {
documentIndex = {
phraseCount: {}, // here we have an object with properties matching it paragraph style, and each property is a map of phrases and their total count.
document: SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema[i],
schemaDocument: SCHEMAS_BY_PROJECT.get(project).array.docsTopicSchema[i],
documentCategory: 'Topics',
project: project
}
@@ -365,27 +365,27 @@ function newSuperalgosDocSpace() {
function indexDocument(documentIndex) {
if (documentIndex.document === undefined) {
if (documentIndex.schemaDocument === undefined) {
return
}
if (documentIndex.document.type !== undefined) {
if (documentIndex.schemaDocument.type !== undefined) {
let paragraph = {
style: 'Type',
text: documentIndex.document.type
text: documentIndex.schemaDocument.type
}
indexParagraph(paragraph)
}
if (documentIndex.document.definition !== undefined) {
if (documentIndex.schemaDocument.definition !== undefined) {
let paragraph = {
style: 'Definition',
text: documentIndex.document.definition
text: documentIndex.schemaDocument.definition
}
indexParagraph(paragraph)
}
if (documentIndex.document.paragraphs !== undefined) {
for (let k = 0; k < documentIndex.document.paragraphs.length; k++) {
let paragraph = documentIndex.document.paragraphs[k]
if (documentIndex.schemaDocument.paragraphs !== undefined) {
for (let k = 0; k < documentIndex.schemaDocument.paragraphs.length; k++) {
let paragraph = documentIndex.schemaDocument.paragraphs[k]
indexParagraph(paragraph)
}
}
@@ -762,7 +762,7 @@ function newSuperalgosDocSpace() {
if (thisPhraseCount === undefined) {
thisPhraseCount = 0
}
if (key === cleanTextForSearch(documentIndex.document.type.toLowerCase())) {
if (key === cleanTextForSearch(documentIndex.schemaDocument.type.toLowerCase())) {
documentPoints = documentPoints + thisPhraseCount * 100
}
@@ -897,10 +897,10 @@ function newSuperalgosDocSpace() {
resultCounter++
HTML = HTML + '<div class="docs-search-result-content-record-container">'
HTML = HTML + '<p class="docs-search-result-content-record-project-category">' + result.documentIndex.project + ' > ' + result.documentIndex.documentCategory + '</p>'
HTML = HTML + '<p><a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + result.documentIndex.documentCategory + '\', \'' + result.documentIndex.document.type + '\', \'' + result.documentIndex.project + '\')" class="docs-search-result-content-record-title">' + result.documentIndex.document.type + '</a></p>'
HTML = HTML + '<p><a onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + result.documentIndex.documentCategory + '\', \'' + result.documentIndex.schemaDocument.type + '\', \'' + result.documentIndex.project + '\')" class="docs-search-result-content-record-title">' + result.documentIndex.schemaDocument.type + '</a></p>'
if (result.documentIndex.document.definition !== undefined) {
HTML = HTML + '<p class="docs-search-result-content-record-extract">' + result.documentIndex.document.definition + '</p>'
if (result.documentIndex.schemaDocument.definition !== undefined) {
HTML = HTML + '<p class="docs-search-result-content-record-extract">' + result.documentIndex.schemaDocument.definition + '</p>'
} else {
HTML = HTML + '<p class="docs-search-result-content-record-extract">' + 'No definition available.' + '</p>'
}
@@ -1299,7 +1299,7 @@ function newSuperalgosDocSpace() {
paragraphIndex++
paragraph = {
style: "Text",
text: "Each type of node might have children. If they do, a reference to the children will be present at runtime at one or more properties of the node object. There is no generic childrenNodes property with an array of children nodes. Instead what we can find is that each node definition defines which properties will hold those children references. The property names that will be used for that are the ones listed here. The " + nodeAppDefinition.type + " node has the following children nodes properties:"
text: "Each type of node might have children. If they do, a reference to the children will be present at runtime at one or more properties of the node object. There is no generic childrenNodes property with an array of children nodes. Instead what we can find is that each schema document defines which properties will hold those children references. The property names that will be used for that are the ones listed here. The " + nodeAppDefinition.type + " node has the following children nodes properties:"
}
renderParagraph(paragraph, key)
paragraphIndex++
@@ -421,10 +421,10 @@ function newUiObject() {
let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects
let compatibleTypes
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.attachingRules !== undefined) {
compatibleTypes = nodeDefinition.attachingRules.compatibleTypes
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.attachingRules !== undefined) {
compatibleTypes = schemaDocument.attachingRules.compatibleTypes
} else {
return
}
@@ -443,15 +443,15 @@ function newUiObject() {
let nearbyNode = floatingObject.payload.node
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) {
/* Discard App Schema defined objects with busy coonection ports */
nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
let mustContinue = false
let parentNodeDefinition = getNodeDefinition(nearbyNode)
if (parentNodeDefinition !== undefined) {
if (parentNodeDefinition.childrenNodesProperties !== undefined) {
for (let j = 0; j < parentNodeDefinition.childrenNodesProperties.length; j++) {
let property = parentNodeDefinition.childrenNodesProperties[j]
if (nodeDefinition.propertyNameAtParent === property.name) {
let parentSchemaDocument = getSchemaDocument(nearbyNode)
if (parentSchemaDocument !== undefined) {
if (parentSchemaDocument.childrenNodesProperties !== undefined) {
for (let j = 0; j < parentSchemaDocument.childrenNodesProperties.length; j++) {
let property = parentSchemaDocument.childrenNodesProperties[j]
if (schemaDocument.propertyNameAtParent === property.name) {
switch (property.type) {
case 'node': {
if (nearbyNode[property.name] !== undefined) {
@@ -563,10 +563,10 @@ function newUiObject() {
let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects
let compatibleTypes
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.referencingRules !== undefined) {
compatibleTypes = nodeDefinition.referencingRules.compatibleTypes
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.referencingRules !== undefined) {
compatibleTypes = schemaDocument.referencingRules.compatibleTypes
} else {
return
}
@@ -584,8 +584,8 @@ function newUiObject() {
let floatingObject = nearby[1]
let nearbyNode = floatingObject.payload.node
if (compatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0 || compatibleTypes === "->*Any Node*->") {
if (nodeDefinition.referencingRules.incompatibleTypes !== undefined) {
if (nodeDefinition.referencingRules.incompatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) {
if (schemaDocument.referencingRules.incompatibleTypes !== undefined) {
if (schemaDocument.referencingRules.incompatibleTypes.indexOf('->' + nearbyNode.type + '->') >= 0) {
continue
}
}
@@ -735,11 +735,11 @@ function newUiObject() {
}
function childrenRunningPhysics() {
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition.childrenNodesProperties === undefined) { return }
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument.childrenNodesProperties === undefined) { return }
let monitorChildrenRunning = false
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (property.monitorChildrenRunning === true) {
let children = thisObject.payload.node[property.name]
if (children === undefined) { continue }
@@ -1165,7 +1165,7 @@ function newUiObject() {
function iconPhysics() {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndType(thisObject.payload.node.project, thisObject.payload.node.type)
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
let schemaDocument = getSchemaDocument(thisObject.payload.node)
/*
If we want this object to have an alternative icon (defined on a list of possible icons) but
@@ -1180,19 +1180,19 @@ function newUiObject() {
Finally, if the node we are pointing to does not have a config or does not have a list of
alternativeIcons, we will just use that node's icon for the current node.
*/
if (nodeDefinition.alternativeIcons !== undefined) {
if (schemaDocument.alternativeIcons !== undefined) {
let nodeToUse = thisObject.payload.node
if (nodeDefinition.alternativeIcons === 'Use Parent') {
if (schemaDocument.alternativeIcons === 'Use Parent') {
if (thisObject.payload.node.payload.parentNode !== undefined) {
nodeToUse = thisObject.payload.node.payload.parentNode
}
}
if (nodeDefinition.alternativeIcons === 'Use Reference Parent') {
if (schemaDocument.alternativeIcons === 'Use Reference Parent') {
if (thisObject.payload.node.payload.referenceParent !== undefined) {
nodeToUse = thisObject.payload.node.payload.referenceParent
}
}
if (nodeDefinition.alternativeIcons === 'Use Reference Grandparent') {
if (schemaDocument.alternativeIcons === 'Use Reference Grandparent') {
if (thisObject.payload.node.payload.referenceParent !== undefined) {
if (thisObject.payload.node.payload.referenceParent.payload !== undefined) {
if (thisObject.payload.node.payload.referenceParent.payload.referenceParent !== undefined) {
@@ -1201,7 +1201,7 @@ function newUiObject() {
}
}
}
if (nodeDefinition.alternativeIcons === 'Use Reference Parent Parent') {
if (schemaDocument.alternativeIcons === 'Use Reference Parent Parent') {
if (thisObject.payload.node.payload.referenceParent !== undefined) {
if (thisObject.payload.node.payload.referenceParent.payload !== undefined) {
if (thisObject.payload.node.payload.referenceParent.payload.parentNode !== undefined) {
@@ -1210,15 +1210,15 @@ function newUiObject() {
}
}
}
nodeDefinition = getNodeDefinition(nodeToUse)
schemaDocument = getSchemaDocument(nodeToUse)
let config = nodeToUse.config
if (config !== undefined && (Array.isArray(nodeDefinition.alternativeIcons) === true)) {
if (config !== undefined && (Array.isArray(schemaDocument.alternativeIcons) === true)) {
try {
config = JSON.parse(config)
let alternativeIcon
let iconName
for (let i = 0; i < nodeDefinition.alternativeIcons.length; i++) {
alternativeIcon = nodeDefinition.alternativeIcons[i]
for (let i = 0; i < schemaDocument.alternativeIcons.length; i++) {
alternativeIcon = schemaDocument.alternativeIcons[i]
if (alternativeIcon.codeName === config.codeName) {
iconName = alternativeIcon.iconName
}
@@ -1231,8 +1231,8 @@ function newUiObject() {
nodeToUse.payload.uiObject.setErrorMessage('The config is not well formatted as a JSON object.')
}
} else {
if (nodeDefinition.icon !== undefined) {
let newIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(nodeToUse.project, nodeDefinition.icon)
if (schemaDocument.icon !== undefined) {
let newIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName(nodeToUse.project, schemaDocument.icon)
if (newIcon !== undefined) {
icon = newIcon
}
@@ -1621,9 +1621,9 @@ function newUiObject() {
if (label !== undefined) {
if (UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.isHierarchyHead !== true && nodeDefinition.isProjectHead !== true) {
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.isHierarchyHead !== true && schemaDocument.isProjectHead !== true) {
return
}
}
@@ -2062,9 +2062,9 @@ function newUiObject() {
browserCanvasContext.fill()
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition === undefined) {
console.log('Node ' + thisObject.payload.node + ' without Node Definition at APP SCHEMA.')
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument === undefined) {
console.log('Node ' + thisObject.payload.node + ' without Schema Document at APP SCHEMA.')
return
}
@@ -2081,7 +2081,7 @@ function newUiObject() {
thisObject.hasError !== true &&
thisObject.WarningError !== true &&
thisObject.hasInfo !== true &&
nodeDefinition.isHierarchyHead !== true &&
schemaDocument.isHierarchyHead !== true &&
thisObject.circularProgressBar === undefined
) {
browserCanvasContext.beginPath()
@@ -2104,7 +2104,7 @@ function newUiObject() {
}
/* Hierarchy Head Ring */
if (nodeDefinition.isHierarchyHead === true) {
if (schemaDocument.isHierarchyHead === true) {
VISIBLE_RADIUS = thisObject.payload.floatingObject.container.frame.radius
if (UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
VISIBLE_RADIUS = UI.projects.superalgos.spaces.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)
@@ -2133,7 +2133,7 @@ function newUiObject() {
}
/* Project Head Ring */
if (nodeDefinition.isProjectHead === true) {
if (schemaDocument.isProjectHead === true) {
VISIBLE_RADIUS = thisObject.payload.floatingObject.container.frame.radius
if (UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
VISIBLE_RADIUS = UI.projects.superalgos.spaces.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)
@@ -2328,11 +2328,11 @@ function newUiObject() {
if (isRunningAtBackend === true || isReadyToReferenceAttach === true || isReadyToChainAttach === true) { additionalImageSize = 20 }
let totalImageSize = additionalImageSize + thisObject.payload.floatingObject.currentImageSize
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument === undefined) { return }
if (UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
if (nodeDefinition.isHierarchyHead === true || nodeDefinition.isProjectHead === true) {
if (schemaDocument.isHierarchyHead === true || schemaDocument.isProjectHead === true) {
totalImageSize = 50
} else {
totalImageSize = 25
@@ -74,7 +74,7 @@ function newUiObjectConstructor() {
*/
if (userAddingNew === true) {
let definition = getNodeDefinition(payload.parentNode)
let definition = getSchemaDocument(payload.parentNode)
if (definition.childrenNodesProperties !== undefined) {
for (let i = 0; i < definition.childrenNodesProperties.length; i++) {
let property = definition.childrenNodesProperties[i]
@@ -174,7 +174,7 @@ function newUiObjectConstructor() {
uiObject.isVisibleFunction = UI.projects.superalgos.spaces.floatingSpace.isThisPointVisible
let menuItemsInitialValues = getMenuItemsInitialValues(uiObject, floatingObject, payload)
let schemaNode = getNodeDefinition(payload.node)
let schemaNode = getSchemaDocument(payload.node)
if (schemaNode === undefined) {
console.log(payload.node.type + ' node found at App Schema. This node will not be created. ')
return
@@ -401,46 +401,46 @@ function newUiObjectConstructor() {
function getMenuItemsInitialValues(uiObject, floatingObject, payload) {
let menuItemsInitialValues = []
let nodeDefinition = getNodeDefinition(payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.editors !== undefined) {
if (nodeDefinition.editors.config === true) {
let schemaDocument = getSchemaDocument(payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.editors !== undefined) {
if (schemaDocument.editors.config === true) {
uiObject.configEditor = newConfigEditor()
uiObject.configEditor.isVisibleFunction = uiObject.isVisibleFunction
uiObject.configEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
uiObject.configEditor.initialize()
}
if (nodeDefinition.editors.code === true) {
if (schemaDocument.editors.code === true) {
uiObject.codeEditor = newCodeEditor()
uiObject.codeEditor.isVisibleFunction = uiObject.isVisibleFunction
uiObject.codeEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
uiObject.codeEditor.initialize()
}
if (nodeDefinition.editors.formula === true) {
if (schemaDocument.editors.formula === true) {
uiObject.formulaEditor = newFormulaEditor()
uiObject.formulaEditor.isVisibleFunction = uiObject.isVisibleFunction
uiObject.formulaEditor.container.connectToParent(uiObject.container, false, false, true, true, false, false, false, false)
uiObject.formulaEditor.initialize()
}
if (nodeDefinition.editors.condition === true) {
if (schemaDocument.editors.condition === true) {
uiObject.conditionEditor = newConditionEditor()
uiObject.conditionEditor.isVisibleFunction = uiObject.isVisibleFunction
uiObject.conditionEditor.container.connectToParent(uiObject.container, false, false, false, true, false, false, false, false)
uiObject.conditionEditor.initialize()
}
}
if (nodeDefinition.addLeftIcons === true) {
addLeftIcons(menuItemsInitialValues, floatingObject, nodeDefinition.isPersonalData)
if (schemaDocument.addLeftIcons === true) {
addLeftIcons(menuItemsInitialValues, floatingObject, schemaDocument.isPersonalData)
}
if (nodeDefinition.isPinned === true) {
if (schemaDocument.isPinned === true) {
floatingObject.isPinned = true
}
if (nodeDefinition.positionLocked === true) {
if (schemaDocument.positionLocked === true) {
floatingObject.positionLocked = true
}
for (let i = 0; i < nodeDefinition.menuItems.length; i++) {
let menutItemDefinition = nodeDefinition.menuItems[i]
for (let i = 0; i < schemaDocument.menuItems.length; i++) {
let menutItemDefinition = schemaDocument.menuItems[i]
let newMenuItem = JSON.parse(JSON.stringify(menutItemDefinition))
/* We need to reference the real function based on its name */
@@ -490,19 +490,19 @@ function newUiObjectConstructor() {
const INITIAL_RADIOUS = 70
const INITIAL_IMAGE_SIZE = 80 * 1.2
let nodeDefinition = getNodeDefinition(payload.node)
if (nodeDefinition === undefined) {
let schemaDocument = getSchemaDocument(payload.node)
if (schemaDocument === undefined) {
console.log('[WARN] Set up of the object ' + payload.node.name + ' of type ' + payload.node.type + ' can not be completed becasue its definition can not be found at the APP SCHEMA.')
return
}
if (nodeDefinition.isProjectHead === true) {
if (schemaDocument.isProjectHead === true) {
level_0()
floatingObject.angleToParent = ANGLE_TO_PARENT.RANGE_360
return
}
switch (nodeDefinition.level) {
switch (schemaDocument.level) {
case 0: {
level_0()
break
@@ -51,9 +51,9 @@ function newUiObjectTitle() {
thisObject.payload = payload
thisObject.allwaysVisible = false // Default value
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.isTitleAllwaysVisible === true) {
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.isTitleAllwaysVisible === true) {
thisObject.allwaysVisible = true
}
}
@@ -100,13 +100,13 @@ function newUiObjectTitle() {
if (thisObject.payload.title === undefined) { return }
/* It is possible to override the default title by setting the APP SCHEMA property 'title' */
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition.title !== undefined) {
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument.title !== undefined) {
thisObject.payload.title = ''
thisObject.payload.node.name = ''
let separator = ''
for (let i = 0; i < nodeDefinition.title.length; i++) {
let titleReference = nodeDefinition.title[i]
for (let i = 0; i < schemaDocument.title.length; i++) {
let titleReference = schemaDocument.title[i]
switch (titleReference) {
case 'Use Parent': {
let nodeToUse = thisObject.payload.parentNode
@@ -230,8 +230,8 @@ function newUiObjectTitle() {
}
function onMouseClick(event) {
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition.title !== undefined) { return }
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument.title !== undefined) { return }
let checkPoint = {
x: 0,
@@ -340,9 +340,9 @@ function newUiObjectTitle() {
labelPoint.x = labelPoint.x - getTextWidth(label) / 2,
labelPoint.y = labelPoint.y - 35
let nodeDefinition = getNodeDefinition(thisObject.payload.node)
if (nodeDefinition !== undefined) {
if (nodeDefinition.isHierarchyHead !== true && nodeDefinition.isProjectHead !== true) {
let schemaDocument = getSchemaDocument(thisObject.payload.node)
if (schemaDocument !== undefined) {
if (schemaDocument.isHierarchyHead !== true && schemaDocument.isProjectHead !== true) {
return
}
}
@@ -303,12 +303,12 @@ function newLayer() {
thisObject.quotedAssetIcon = getIcon(thisObject.quotedAsset)
function getIcon(node) {
let nodeDefinition = getNodeDefinition(node)
let schemaDocument = getSchemaDocument(node)
let iconName
let icon
if (nodeDefinition.alternativeIcons !== undefined) {
for (let i = 0; i < nodeDefinition.alternativeIcons.length; i++) {
let alternativeIcon = nodeDefinition.alternativeIcons[i]
if (schemaDocument.alternativeIcons !== undefined) {
for (let i = 0; i < schemaDocument.alternativeIcons.length; i++) {
let alternativeIcon = schemaDocument.alternativeIcons[i]
if (alternativeIcon.codeName === node.config.codeName) {
iconName = alternativeIcon.iconName
}
@@ -317,7 +317,7 @@ function newLayer() {
if (iconName !== undefined) {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', iconName)
} else {
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', nodeDefinition.icon)
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName('Superalgos', schemaDocument.icon)
}
return icon
}
+5 -5
View File
@@ -23,8 +23,8 @@ function newSuperalgosUtilitiesBranches() {
function scanNodeBranch(startingNode) {
if (startingNode === undefined) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(startingNode)
if (schemaDocument === undefined) { return }
if (nodeType === undefined) {
resultArray.push(startingNode)
@@ -35,10 +35,10 @@ function newSuperalgosUtilitiesBranches() {
}
}
if (nodeDefinition.childrenNodesProperties === undefined) { return }
if (schemaDocument.childrenNodesProperties === undefined) { return }
let lastNodePropertyName
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
if (lastNodePropertyName === property.name) { continue } // Some nodes have a single property por multiple child node types. We need to check repeated properties only once so as no to duplicate results.
switch (property.type) {
case 'node': {
+5 -5
View File
@@ -25,12 +25,12 @@ function newSuperalgosUtilitiesFolders() {
if (destinationNode === undefined) { return }
/* Now we go down through all the children of the origin node, recreating at the destination node the same children structure*/
let nodeDefinition = getNodeDefinition(originNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(originNode)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.name) {
case originObjectsArrayPropertyName: {
@@ -20,13 +20,13 @@ function newSuperalgosUtilitiesHierarchy() {
hiriatchyMap.set(node.id, node)
/* Now we go down through all this node children */
let nodeDefinition = getNodeDefinition(node)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(node)
if (schemaDocument === undefined) { return }
if (nodeDefinition.childrenNodesProperties !== undefined) {
if (schemaDocument.childrenNodesProperties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
+5 -5
View File
@@ -24,8 +24,8 @@ function newSuperalgosUtilitiesMeshes() {
if (nodeFound !== undefined) { return }
if (depth >= MAX_DEPTH) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(startingNode)
if (schemaDocument === undefined) { return }
if (nodeType !== undefined) {
if (startingNode.type === nodeType) {
@@ -43,9 +43,9 @@ function newSuperalgosUtilitiesMeshes() {
/* We scan through this node children */
if (findInChildren === true) {
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -18,13 +18,13 @@ function newSuperalgosUtilitiesNodeChildren() {
if (startingNode === undefined) { return }
if (checkNode === undefined) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(startingNode)
if (schemaDocument === undefined) { return }
/* We scan through this node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -81,13 +81,13 @@ function newSuperalgosUtilitiesNodeChildren() {
if (startingNode === undefined) { return }
if (checkNode === undefined) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(startingNode)
if (schemaDocument === undefined) { return }
/* We scan through this node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -167,13 +167,13 @@ function newSuperalgosUtilitiesNodeChildren() {
let parentNode = startingNode.payload.parentNode
let nodeDefinition = getNodeDefinition(parentNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(parentNode)
if (schemaDocument === undefined) { return }
/* We scan through this parent node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
@@ -205,13 +205,13 @@ function newSuperalgosUtilitiesNodeChildren() {
*/
if (startingNode === undefined) { return }
let nodeDefinition = getNodeDefinition(startingNode)
if (nodeDefinition === undefined) { return }
let schemaDocument = getSchemaDocument(startingNode)
if (schemaDocument === undefined) { return }
/* We scan through this node children */
if (nodeDefinition.childrenNodesProperties !== undefined) {
for (let i = 0; i < nodeDefinition.childrenNodesProperties.length; i++) {
let property = nodeDefinition.childrenNodesProperties[i]
if (schemaDocument.childrenNodesProperties !== undefined) {
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {
let property = schemaDocument.childrenNodesProperties[i]
switch (property.type) {
case 'node': {
+3 -3
View File
@@ -84,9 +84,9 @@ function preLoader() {
let project = projectSchemas[i]
for (let j = 0; j < project.schema.length; j++) {
let nodeDefinition = project.schema[j]
let key = project.name + '-' + nodeDefinition.type
TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.set(key, nodeDefinition)
let schemaDocument = project.schema[j]
let key = project.name + '-' + schemaDocument.type
TS.projects.superalgos.globals.taskConstants.APP_SCHEMA_MAP.set(key, schemaDocument)
}
}
}
+12 -12
View File
@@ -61,9 +61,9 @@ function newAppPostLoader() {
schemas.array.appSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.appSchema.length; j++) {
let nodeDefinition = schemas.array.appSchema[j]
let key = nodeDefinition.type
schemas.map.appSchema.set(key, nodeDefinition)
let schemaDocument = schemas.array.appSchema[j]
let key = schemaDocument.type
schemas.map.appSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
@@ -81,9 +81,9 @@ function newAppPostLoader() {
schemas.array.docsNodeSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsNodeSchema.length; j++) {
let nodeDefinition = schemas.array.docsNodeSchema[j]
let key = nodeDefinition.type
schemas.map.docsNodeSchema.set(key, nodeDefinition)
let schemaDocument = schemas.array.docsNodeSchema[j]
let key = schemaDocument.type
schemas.map.docsNodeSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
@@ -101,9 +101,9 @@ function newAppPostLoader() {
schemas.array.docsConceptSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsConceptSchema.length; j++) {
let nodeDefinition = schemas.array.docsConceptSchema[j]
let key = nodeDefinition.type
schemas.map.docsConceptSchema.set(key, nodeDefinition)
let schemaDocument = schemas.array.docsConceptSchema[j]
let key = schemaDocument.type
schemas.map.docsConceptSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
@@ -121,9 +121,9 @@ function newAppPostLoader() {
schemas.array.docsTopicSchema = JSON.parse(schema)
for (let j = 0; j < schemas.array.docsTopicSchema.length; j++) {
let nodeDefinition = schemas.array.docsTopicSchema[j]
let key = nodeDefinition.type
schemas.map.docsTopicSchema.set(key, nodeDefinition)
let schemaDocument = schemas.array.docsTopicSchema[j]
let key = schemaDocument.type
schemas.map.docsTopicSchema.set(key, schemaDocument)
}
} catch (err) {
console.log(err.stack)
+2 -2
View File
@@ -1,6 +1,6 @@
function getNodeDefinition(node, project) {
function getSchemaDocument(node, project) {
if (node === null || node === undefined) {
console.log('[Error] Can not get the node definition of a null or undefined node ')
console.log('[Error] Can not get the schema document of a null or undefined node ')
return
}
if (project === undefined) { project = node.project }