process-analytics / bpmn-visualization-addons

Add-ons for `bpmn-visualization`.
https://process-analytics.github.io/bpmn-visualization-addons/
Apache License 2.0
3 stars 0 forks source link

feat: introduce `CasePathResolver` #142

Closed tbouffard closed 12 months ago

tbouffard commented 1 year ago

This new class is dedicated to path resolution of a single instance/case of a process.

Given a set of elements considered as completed, it is currently able to compute the edges between the provided shapes and the shapes around the provided edges. This is the first step towards the implementation of more intelligent computing in the future.

In addition

Covers #16 Closes #22 Covers #24

Notes about the types introduced in this PR

The types of the parameter and the returned value are defined to correspond to the state of the final implementation as it is known today. There should be no discussion of types in this PR as the API is not finalized. What follows is the current proposal with an overview of the structure. It does not mean that the final implementation will be like this (in particular, do not debate now about a pseudo duplication in the type definition, it is too early as the types may change).

export type CasePathResolverInput = {
    /**
     * The IDs of elements (flowNodes/shapes and flows/edges) that are already completed. Non-existing ids will be silently ignored.
     *
     * `Completed` means that the element has been fully executed or definitively cancelled (for BPM engine that supports it and allow instance continuation of cancelled elements).
     * No further user action or automation will update the element.
     */
    completedIds: string[];

    // see see https://github.com/process-analytics/bv-experimental-add-ons/issues/16
    pendingIds?: string[];
};
export type CasePathResolverOutput = {
    /**
     * The `BpmnSemantic` objects retrieved from the model that relate to the ids passed in {@link CasePathResolverInput}.
     */
    provided: {
        completed: {
            shapes: ShapeBpmnSemantic[];
            edges: EdgeBpmnSemantic[];
        };
        // It is not sure that we will let configure pending edges, see https://github.com/process-analytics/bv-experimental-add-ons/issues/16
        pending?: {
            shapes: ShapeBpmnSemantic[];
            edges: EdgeBpmnSemantic[];
        };
    };
    computed: {
        completed: {
            shapes: ShapeBpmnSemantic[];
            edges: EdgeBpmnSemantic[];
        };
        // This may require a more complex type if we want to provide information about why the elements are considered as candidates only
        // We may also split pending and completed elements
        // See https://github.com/process-analytics/bv-experimental-add-ons/issues/24
        candidates: {
            shapes: ShapeBpmnSemantic[];
            edges: EdgeBpmnSemantic[];
        };
    };
};
github-actions[bot] commented 1 year ago

:recycle: PR Preview d065c70045b897f1192d9e6d9cb343fdf97e5de7 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

tbouffard commented 1 year ago

Putting in draft, waiting for creating issues related to duplicated results returned by the bpmn-visualization API. [UPDATE] issues created, so ready for merge.

sonarcloud[bot] commented 12 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication