
Security News
OpenGrep Restores Fingerprinting in JSON and SARIF Outputs
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
@5minds/processcube_engine_client
Advanced tools
Contains a typescript based client for accessing the Engine.
Ein NodeJS basierter Client zur Kommunikation mit der ProcessCube Engine.
Codebeispiele zur Verwendung des Clients und der External Task Worker finden sich hier.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const processInstancesInCorrelation = await client.processInstances.query({
correlationid: 'my-correlation-id',
});
Man benötigt lediglich die URL der anzusteuernden Engine. Mit dieser lässt sich eine Instanz des Clients anlegen, die direkt verwendbar ist.
Es gibt verschiedene Wege sich Clients anzulegen.
Man kann eine Instanz des EngineClients
direkt anlegen, welche die API der ProcessCube Engine vollständig abdeckt.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const processInstancesInCorrelation = await client.processInstances.query({
correlationid: 'my-correlation-id',
});
Oder man kann sich über die Client Factory einen feature-spezifischen Client anlegen, der nur einen besimmten fachlichen Aspekt der ProcessCube Engine abdeckt.
Beispiel:
import { ClientFactory } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const processInstanceClient = ClientFactory.createProcessInstanceClient(engineUri);
const processInstances = await processInstanceClient.query({
correlationid: 'my-correlation-id',
});
Hier wird eine Client Instanz angelegt, welche lediglich die Interaktion mit Prozessinstanzen abdeckt.
Nachfolgend werden ein paar der am häufigsten verwendeten Use Cases demonstriert.
Das Starten von Prozessinstanzen kann über die EngineClient.processModels
Fachlichkeit realisiert werden.
Prozesse lassen sich auf mehrere Arten starten.
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstance({ processModelId: 'myProcessModelId' });
Die processModelId
ist der einzige erforderliche Parameter für diesen Request.
Der Client wartet in diesem Szenario nur, bis die Engine den Start des Prozesses bestätigt hat.
Neben der processModelId
können folgende Paramter mitgegeben werden:
startEventId
: Die ID des Start Events von welchem aus der Prozess losgehen soll
correlationId
: Gibt an, in welcher Correlation die Prozessinstanz laufen sollinitialToken
: Der JSON-formatierte Prozess-Token, den die Prozessinstanz zu beginn besitzen sollimport { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstance({
processModelId: 'myProcessModelId',
startEventId: 'StartEvent_1',
correlationId: 'MyCorrelatioNid',
initialToken: {
hello: 'world',
},
});
import { EngineClient } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
await client.processModels.startProcessInstanceAndAwaitEndEvent({ processModelId: 'myProcessModelId' });
Hier wartet der Client, bis die Engine den Prozess bis zum Ende ausgeführt hat.
Die Methode akzeptiert dieselben Parameter wie processModels.startProcessInstance
.
Abfragen aller User Tasks eines bestimmten Prozesses, die sich in einem "suspended" State befinden:
import { EngineClient, DataModels } from '@5minds/processcube_engine_client';
const engineUri = 'http://localhost:10560';
const client = new EngineClient(engineUri);
const userTasks = await client.userTasks.query({
processModelId: 'myProcessModelId',
state: DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended,
});
console.log(userTasks);
External Task Worker werden dazu benutzt, um die an einer Prozessinstanz anfallenden External Service Tasks
zu verarbeiten.
Ein Worker benötigt minimal die folgenden 3 Einstellungen
Beispiel:
import { ExternalTaskWorker } from '@5minds/processcube_engine_client';
interface AddPayload {
number1: number;
number2: number;
}
interface AddResult {
sum: number;
}
const engineUri = 'http://localhost:10560';
const topic = 'sum_numbers';
const externalTaskWorker = new ExternalTaskWorker<AddPayload, AddResult>(url, topic, doAdd, config);
externalTaskWorker.start();
async function doAdd(payload: AddPayload, externalTask: DataModels.ExternalTasks.ExternalTask<AddPayload>): Promise<AddResult> {
const result: AddResult = {
sum: payload.number1 + payload.number2,
};
return result;
}
Der Worker lässt sich mit folgendem Befehl starten:
externalTaskWorker.start();
und mit folgendem Befehl stoppen:
externalTaskWorker.stop();
Ein ausführbares Code-Beispiel findet sich hier.
FAQs
Contains a typescript based client for accessing the Engine.
The npm package @5minds/processcube_engine_client receives a total of 2,953 weekly downloads. As such, @5minds/processcube_engine_client popularity was classified as popular.
We found that @5minds/processcube_engine_client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 30 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.