Process

fetch()

Updates local class, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.fetch();
    })
    .catch(err => {})

update(data)

Updates the process, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.update({
            title: 'New Process'
        });
    })
    .catch(err => {})

Data parameter contains the updated parameters of the process.

Name Type Description
title String Process name

clone(data)

Clones a process, function returns Promise.

Name Type Description
data.title String Process name
const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.clone({
            title: 'New title'
        });
    })
    .catch(err => {})

remove()

Deletes the process, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.remove();
    })
    .catch(err => {})

start()

Starts the process, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.start();
    })
    .catch(err => {})
Name Type Description

stop()

Stops the process, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.stop();
    })
    .catch(err => {})

List logs()

Gets list of logs, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.getLogs();
    })
    .catch(err => {})

Flush logs()

Flush logs, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.flushLogs();
    })
    .catch(err => {})

createConnector(data)

Adds a connector to the process, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.createConnector({
            "parentId": "58ecbfbb27218c3c9fa8b2ae",
            "params": {
                "code": "return 1 == 1",
                "results": {
                    "true": [],
                    "false": []
                }
            }
        });
    })
    .catch(err => {})

Data parameter contains the parameters of the added connector.

Name Type Description
parentId String Identifier of the connector previously registered in the system
params Object Parameters of the added connector, defined by the parent connector type

updateConnector(id, data)

Updates process connector parameters, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.updateConnector(id, {          
            "params": {
                "code": "return 2 == 2",
                "results": {
                    "true": [],
                    "false": []
                }
            }
        });
    })
    .catch(err => {})
Name Type Description
id String Connector identifier
params Object Parameters of the added connector, defined by the parent connector type

setRelation(source, target)

Creates a connection between the connectors, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.setRelation(id1, id2);
    })
    .catch(err => {})
Name Type Description
source String Parent connector identifier
target String Parent connector identifier

setRelationName(source, target, name)

Sets up the child connector so that it is executed only at a particular parent connector value, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.setRelationName(id1, id2, 'true');
    })
    .catch(err => {})
Name Type Description
source String Parent connector identifier
target String Parent connector identifier
name String Name of the connector execution result

unsetRelation(source, target)

Deletes the connection between connectors, function returns Promise.

const service = new Mixapp.Service([options])
service.workplaces.get('workplace')
    .then(workplace => {
        return workplace.process.get(id);
    })
    .then(process => {
        return process.unsetRelation(id1, id2);
    })
    .catch(err => {})
Name Type Description
source String Parent connector identifier
target String Parent connector identifier