Interface BPClient

interface BPClient {
    activateFSM: ((id) => Dict);
    activeTask: ((iid) => Dict[]);
    addHistory: ((iid, msg) => string);
    complete: ((iid, input) => Dict);
    continue: ((iid, input) => Dict);
    createFSM: ((data) => Dict);
    deactivateFSM: ((id) => void);
    delegate: ((iid, assignee, reason) => void);
    delete: ((id) => number);
    deleteInstance: ((instanceID, reason) => void);
    fsmAddSLA: ((id, data, objName?) => Dict);
    fsmAddStep: ((id, data, objName?) => Dict);
    fsmAddVar: ((id, data, objName?) => Dict);
    fsmDeleteSLA: ((id, objName?) => number);
    fsmDeleteStep: ((id, objName?) => number);
    getProcessSteps: ((id) => Dict[]);
    getSLA: ((id) => Dict[]);
    getVars: ((instanceID, names) => Dict);
    modifyFSM: ((id, data) => Dict);
    resume: ((instanceID) => void);
    setVars: ((instanceID, values) => void);
    start: ((name, input, version?) => Dict);
    suspend: ((instanceID) => void);
    terminate: ((instanceID, reason) => void);
}

Properties

activateFSM: ((id) => Dict)

active one FSM in BP

Type declaration

    • (id): Dict
    • Parameters

      • id: string

        record id

      Returns Dict

Example


import * as bp from 'bp'
let client = bp.newClientV1()
let res=client.activateFSM("id");

Returns

return compile result

activeTask: ((iid) => Dict[])

get active tasks

Type declaration

    • (iid): Dict[]
    • Parameters

      • iid: string

      Returns Dict[]

Example


import * as bp from 'bp'
let client = bp.newClientV1()
let res=client.activeTask("iid");

Returns

active tasks

addHistory: ((iid, msg) => string)

add history record of BP to db

Type declaration

    • (iid, msg): string
    • Parameters

      • iid: string

        bp interview id

      • msg: string

        message

      Returns string

Example

import {addHistory} bp from 'bp';
addHistory("iid","message");

Returns

inserted record id

complete: ((iid, input) => Dict)

complete current task(fill page/screen and commit) and continue the BP instance

Type declaration

    • (iid, input): Dict
    • Parameters

      • iid: string

        bp interview id

      • input: Dict

        input parameters

      Returns Dict

Example

import {complete} bp from 'bp';
let client = bp.newClientV1()
let res=client.complete("bpId","inputData");

Returns

result

continue: ((iid, input) => Dict)

continue to complete current task

Type declaration

    • (iid, input): Dict
    • Parameters

      • iid: string

        bp interview id

      • input: Dict

        input parameters

      Returns Dict

Example

import {continue} bp from 'bp';
let client = bp.newClientV1()
let res=client.continue("bpId","inputData");

Result

result

createFSM: ((data) => Dict)

create a new FSM in BP

Type declaration

Example

import * as bp from 'bp'
let client = bp.newClientV1()
let fsm = client.createFSM("data");

Returns

if create fsm, only return record id

deactivateFSM: ((id) => void)

deactivate one FSM in BP

Type declaration

    • (id): void
    • Parameters

      • id: string

        record id

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
let fsm = client.createFSM("data");
fsm.deactivateFSM("fsmId");
delegate: ((iid, assignee, reason) => void)

delegate task to another user or queue to process

Type declaration

    • (iid, assignee, reason): void
    • Parameters

      • iid: string

        bp interview id

      • assignee: string
      • reason: string

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
client.delegate("002N000000VwBrSDISbQ","user","resons")
delete: ((id) => number)

delete one bp record

Type declaration

    • (id): number
    • Parameters

      • id: string

        record id

      Returns number

Example

import {delete} from 'bp'
let res=delete"002N000000VwBrSDISbQ");

Returns

deleted number

deleteInstance: ((instanceID, reason) => void)

delete flow instance and related resource

Type declaration

    • (instanceID, reason): void
    • Parameters

      • instanceID: string
      • reason: string

        delete reason

      Returns void

Example

import {deleteInstance} from 'bp'
let client = bp.newClientV1()
client.deleteInstance"flowId","Unnecessary flow");
fsmAddSLA: ((id, data, objName?) => Dict)

add one fsm sla

Type declaration

    • (id, data, objName?): Dict
    • Parameters

      • id: string

        record id

      • data: Dict

        content

      • Optional objName: string

        optional

      Returns Dict

Example

import {fsmAddSLA} from 'bp'
let res =fsmAddSLA("id","data"); // 返回null代表成功,失败的话会抛出错误信息

Returns

compile result

fsmAddStep: ((id, data, objName?) => Dict)

add one fsm step

Type declaration

    • (id, data, objName?): Dict
    • Parameters

      • id: string

        record id

      • data: Dict

        content

      • Optional objName: string

        optional

      Returns Dict

Example

import {fsmAddStep} from 'bp'
fsm.fsmAddStep("stepId","stepData"); // 返回null代表成功,失败的话会抛出错误信息

Returns

compile result

fsmAddVar: ((id, data, objName?) => Dict)

add one fsm var

Type declaration

    • (id, data, objName?): Dict
    • Parameters

      • id: string

        record id

      • data: Dict

        content

      • Optional objName: string

        optional

      Returns Dict

Example

import {fsmAddVar} from 'bp'
fsm.fsmAddVar("varId","varData"); // 返回null代表成功,失败的话会抛出错误信息

Returns

compile result

fsmDeleteSLA: ((id, objName?) => number)

delete one fsm SLA

Type declaration

    • (id, objName?): number
    • Parameters

      • id: string

        record id

      • Optional objName: string

        optional

      Returns number

Example

import {fsmDeleteSLA} from 'bp'
let res=fsm.fsmDeleteSLA("002N000000VwBrSDISbQ")

Returns

deleted count

fsmDeleteStep: ((id, objName?) => number)

delete one fsm step

Type declaration

    • (id, objName?): number
    • Parameters

      • id: string

        record id

      • Optional objName: string

        optional

      Returns number

Example

import {fsmDeleteStep} from 'bp
fsm.fsmDeleteStep("002N000000VwBrSDISbQ")

Returns

deleted count

getProcessSteps: ((id) => Dict[])

get process steps in one bp record

Type declaration

    • (id): Dict[]
    • Parameters

      • id: string

      Returns Dict[]

Example

import * as bp from 'bp'
let bpInstance=bp.newClientV1();
let progessList = bpInstance.getProcessSteps("002N000000VwBrSDISbQ")

Returns

process steps

getSLA: ((id) => Dict[])

get sla in one bp record

Type declaration

    • (id): Dict[]
    • Parameters

      • id: string

      Returns Dict[]

Example

import * as bp from 'bp'
let bpInstance=bp.newClientV1();
let slaList = bpInstance.getSLA("002N000000VwBrSDISbQ")

Returns

sla

getVars: ((instanceID, names) => Dict)

get values of variables

Type declaration

    • (instanceID, names): Dict
    • Parameters

      • instanceID: string

        instance id

      • names: string[]

        get values by names. if names is empty then get values of all variables

      Returns Dict

Example

import * as bp from 'bp'
let client=bp.newClientV1();
let vars = client.getVars("002N000000VwBrSDISbQ", ["foo", "bar"])
console.log(vars)

Returns

variable values

modifyFSM: ((id, data) => Dict)

modify one FSM in BP

Type declaration

    • (id, data): Dict
    • Parameters

      • id: string

        record id

      • data: Dict

        FSM content

      Returns Dict

Example

import * as bp from 'bp'
let instClient = bp.newClientV1();
let res = bp.modifyFSM("002N000000VwBrSDISbQ","FSMData") // 返回null代表成功,失败的话会抛出错误信息

Returns

compile result

resume: ((instanceID) => void)

resume bp

Type declaration

    • (instanceID): void
    • Parameters

      • instanceID: string

        instance id

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
let res = client.resume("002N000000VwBrSDISbQ")
setVars: ((instanceID, values) => void)

set values to according variables

Type declaration

    • (instanceID, values): void
    • Parameters

      • instanceID: string

        instance id

      • values: Dict

        variables

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
client.setVars("002N000000VwBrSDISbQ", {"foo": "aaa","bar": "bbb"})
start: ((name, input, version?) => Dict)

start executing a BP

Type declaration

    • (name, input, version?): Dict
    • Parameters

      • name: string

        the name of the bp

      • input: Dict
      • Optional version: string

        the version of bp, optional

      Returns Dict

Example

import * as bp from 'bp'
let client = bp.newClientV1()
let res = client.start("test", { "foo": 1, "bar": 3}, "1.0.1")

Input

input the parameters of bp

Returns

result. For example,

 {
"interviewId": "002N000000FdtN6xwgjI",
"screen": {
"allowBack": false,
"allowFinish": true,
"allowNext": true,
"allowPause": false,
"helpText": "",
"label": "input phone number",
"name": "inputphonenumber",
"pausedText": "",
"screenFields": [
{
"dataType": "text",
"defaultValue": "135xxxxxxxx",
"fieldType": "InputField",
"helpText": "",
"isRequired": false,
"label": "phone number",
"name": "phoneNumber"
}
]
}
suspend: ((instanceID) => void)

suspend bp

Type declaration

    • (instanceID): void
    • Parameters

      • instanceID: string

        instance id

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
let res = client.suspend("002N000000VwBrSDISbQ")
terminate: ((instanceID, reason) => void)

terminate BP and related resource

Type declaration

    • (instanceID, reason): void
    • Parameters

      • instanceID: string

        instance id

      • reason: string

        terminate reason

      Returns void

Example

import * as bp from 'bp'
let client = bp.newClientV1()
client.terminate("bpId","bp is end")