itesoft-bpmn-sdk
v1.0.2
Published
[![npm version](https://badge.fury.io/js/itesoft-bpmn-sdk.svg)](https://badge.fury.io/js/itesoft-bpmn-sdk)
Downloads
2
Maintainers
Readme
itesoft-bpmn-sdk
Node.js SDK for Itesoft Engine API.
Table of Contents
- How does it work?
- Install
- Basic usage
- API Reference
- Activity Instance
- Get activity instances
- Get activity instances count
- Get activity instance by id
- Claim activity instance by id
- Option claim activity instance by id
- Disclaim activity instance by id
- Complete activity instance by id
- Save activity instance by id
- Assign activity instance potential owner
- Unassign activity instance potential owner
- Authentication
- Engine
- Preference
- Process
- Process Instances
- Signal Instance
- Supports
- User
- Activity Instance
- Contributing
- License
How does it work?
itesoft-bpmn-sdk works as a connector between the customer and the Itesoft Engine API.
Install
$ npm install --save itesoft-bpmn-sdk
Basic usage
It can be imported with CommonJS, ES2015 modules, and preferably TypeScript.
The library is written in TypeScript and includes TypeScript definitions by default. Nevertheless, it can surely be used with plain JavaScript too.
// CommonJS
const itesoft = require('itesoft-bpmn-sdk');
// ES6 modules or TypeScript
import * as itesoft from 'itesoft-bpmn-sdk';
Configuration
import Client, {
BasicAuthEngine,
ClientConfig
} from "itesoft-bpmn-sdk";
const config: BasicAuthEngine = {
// Username for the basic auth to the engine
username: "USERNAME",
// Password for the basic auth to the engine
password: "PASSWORD",
};
const config: ClientConfig = {
// Username for the basic auth to the engine
apiUrl: "http://example.com",
};
new Client(basicAuth, clientConfig);
Custom header
You can add custom headers like that:
const clientConfig: ClientConfig = {
apiUrl: "http://example.com",
headers: {
"CUSTOM-HEADER": "test",
},
}
Logging
itesoft-bpmm-sdk can log http requests executed, if you active the log option like that:
const clientConfig: ClientConfig = {
apiUrl: "http://example.com",
log: true,
}
API Reference
Activity Instance
Get activity instances
Returns the activity instances matching the given filter
const client = new Client(basicAuth, clientConfig);
client.getActivityInstances(principal, attachment, filter, sortList, offset, maximumNumberOfResults)
.then(response => console.log(response))
.catch(error => console.log(error));
Get activity instances count
Returns the number of results a search of activity instances will return
const client = new Client(basicAuth, clientConfig);
client.getActivityInstancesCount(principal, filter, cacheConfiguration)
.then(response => console.log(response))
.catch(error => console.log(error));
Get activity instance by id
Returns the requested activity instance or an exception if the requested activity instance does not exist
const client = new Client(basicAuth, clientConfig);
client.getActivityInstanceById(activityInstanceId, principal, identifier, attachment)
.then(response => console.log(response))
.catch(error => console.log(error));
Claim activity instance by id
Claims the user task instance for the connected user. Only a potential owner and not excluded owner can claim a user task instance
const client = new Client(basicAuth, clientConfig);
client.claimActivityInstanceById(activityInstanceId, principal, identifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Option claim activity instance by id
Option Claims the user task instance for the connected user. Only a potential owner and not excluded owner can claim a user task instance
const client = new Client(basicAuth, clientConfig);
client.optionClaimActivityInstanceById(activityInstanceId, principal, identifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Disclaim activity instance by id
Disclaims the user task instance for the connected user. Only a potential owner and not excluded owner can disclaim a user task instance
const client = new Client(basicAuth, clientConfig);
client.disclaimActivityInstanceById(activityInstanceId, principal, identifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Complete activity instance by id
Completes the given activity instance
const client = new Client(basicAuth, clientConfig);
client.completeActivityInstanceById(activityInstanceId, principal, identifier, dataEntries)
.then(response => console.log(response))
.catch(error => console.log(error));
Save activity instance by id
Completes the given activity instance
const client = new Client(basicAuth, clientConfig);
client.saveActivityInstanceById(activityInstanceId, principal, identifier, dataEntries)
.then(response => console.log(response))
.catch(error => console.log(error));
Assign activity instance potential owner
Assign an activity instance potential owner
const client = new Client(basicAuth, clientConfig);
client.assignActivityInstancePotentialOwner(activityInstanceId, principal, identifier, userIdentifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Unassign activity instance potential owner
Unassign an activity instance potential owner
const client = new Client(basicAuth, clientConfig);
client.unassignActivityInstancePotentialOwner(activityInstanceId, userId, principal, identifier, userIdentifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Authentication
Login
Logs in the given user with the given password. Allows to propagate the login to other modules.
const client = new Client(basicAuth, clientConfig);
client.login(username, password, propagate)
.then(response => console.log(response))
.catch(error => console.log(error));
Logout
Logs the given principal out.
const client = new Client(basicAuth, clientConfig);
client.logout(principal)
.then(response => console.log(response))
.catch(error => console.log(error));
Engine
Get engine core version
Returns the Engine Core version.
const client = new Client(basicAuth, clientConfig);
client.getEngineCoreVersion()
.then(response => console.log(response))
.catch(error => console.log(error));
Get engine check availability
Checks the engine service availability. If this method returns with no error,it means the server is still available.
const client = new Client(basicAuth, clientConfig);
client.getEngineCheckAvailability()
.then(response => console.log(response))
.catch(error => console.log(error));
Preference
Get preferences
Returns the preferences matching the given filter
const client = new Client(basicAuth, clientConfig);
client.getPreferences(principal, attachment, filter, sortList, offset, maximumNumberOfResults)
.then(response => console.log(response))
.catch(error => console.log(error));
Get preference
Returns the preference matching the given identifier
const client = new Client(basicAuth, clientConfig);
client.getPreference(identifier, principal, attachment)
.then(response => console.log(response))
.catch(error => console.log(error));
Process
Get process instantiable process identifiers
Returns the identifiers of processes that can be instantiate by the connected user. Each process identifier is associated with the available collaboration identifiers. null means theprocess can be instantiated in a standalone mode.
const client = new Client(basicAuth, clientConfig);
client.getProcessInstantiableProcessIdentifiers(principal)
.then(response => console.log(response))
.catch(error => console.log(error));
Process instances
Get process instances
Returns the process instances matching the given filter.
const client = new Client(basicAuth, clientConfig);
client.getProcressInstances(principal, attachment, filter, sortList, offset, maximumNumberOfResults)
.then(response => console.log(response))
.catch(error => console.log(error));
Get process instances count
Returns the number of results a search of process instances will return.
const client = new Client(basicAuth, clientConfig);
client.getProcressInstancesCount(principal, filter)
.then(response => console.log(response))
.catch(error => console.log(error));
Get process instance by id
Returns the requested process instance or an exception if the requested process instance does not exist.
const client = new Client(basicAuth, clientConfig);
client.getProcressInstanceById(processInstanceId, principal,identifier, attachment)
.then(response => console.log(response))
.catch(error => console.log(error));
Instantiate process instance
Instantiate a process and returns it's identifier.
const client = new Client(basicAuth, clientConfig);
client.instantiateProcessInstance(collaborationIdentifier, identifier, name, makeNameUnique, dataEntries, initializeAllData, attributes, principal)
.then(response => console.log(response))
.catch(error => console.log(error));
Put process instance to terminate
Terminates the given process instance.
const client = new Client(basicAuth, clientConfig);
client.putProcessInstanceToTerminate(processInstanceId, principal, identifier)
.then(response => console.log(response))
.catch(error => console.log(error));
Signal instance
Trigger signal instance
Triggers the given signal.
const client = new Client(basicAuth, clientConfig);
client.triggerSignalInstance(signalIdentifier, signalName, principal, payload)
.then(response => console.log(response))
.catch(error => console.log(error));
Supports
Get supports by feature
Returns a boolean indicating if the feature is supported. This method can be used to manage ascending compatibility on client side.
const client = new Client(basicAuth, clientConfig);
client.getSupportsByFeature(feature)
.then(response => console.log(response))
.catch(error => console.log(error));
User
Get users
Returns the users matching the given filter.
const client = new Client(basicAuth, clientConfig);
client.getUsers(principal, attachment, filter, sortList, offset, maximumNumberOfResults)
.then(response => console.log(response))
.catch(error => console.log(error));
Get user by id
Returns the user matching the given identifier.
const client = new Client(basicAuth, clientConfig);
client.getUserById(userId, principal, identifier, attachment)
.then(response => console.log(response))
.catch(error => console.log(error));
Get user groups
Returns the groups of a user.
const client = new Client(basicAuth, clientConfig);
client.getUserGroups(userId, principal, identifier, attachment)
.then(response => console.log(response))
.catch(error => console.log(error));
Contributing
Thanks for wanting to contribute! Take a look at our Contributing Guide for notes on our commit message conventions and how to run tests.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
License
Copyright (c) 2019 SombreroElGringo