npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

process-reporting-ts

v2.5.0

Published

Process reporting with typescript

Downloads

425

Readme

Process Report Starter

Dependency management is a critical aspects of any complex project. And doing this manually is less than ideal; the more time you spent on it the less time you have on the other important aspects of the project. Process report Starter were built to address exactly this problem. You get a one-stop-shop for all the functionality that you need to audit your process flow.

Event Reporting Workflow

Event Reporting Process View

Event Reporting Instance View

Event Reporting Instance Details View

Event Reporting Porcess Diagram View

Event Reporting Porcess Report View

Requirements

  • NPM package
      npm install process-reporting-ts
  • @BpmnElement on method
      import {BpmnElement} from "process-reporting-ts";
      
      @BpmnElement(id = "Event_1anjljr", startEvent = true, keyExpression = "{{ event.PO_NUMBER }}")
      public execute(PurchaseOrderEvent event) {
    
          return ...;
      }
    
      ----
    
      @BpmnElement(id = "Activity_194xhhj")
      public execute(PurchaseOrder data) {
    
          return ...;
      }
    
      ---
    
      @BpmnElement(id = "Event_0byexdn", endEvent = true)
      public execute(ProcurementOrder procurementOrder, boolean purchaseOrderExists) {
    
          return ...;
      }
  • AOP on function
import {interceptHandler} from "process-reporting-ts";

function execute(PurchaseOrderEvent data) {

   return ...
}

const aopHandler = interceptHandler(execute, {
    startEvent: true,
    instanceIdExpression: '{{ headers.TX_ID }}',
    keyExpression: '{{ data.PO_NUMBER }}'
})
  • .env
    REPORTING_PROCESS_ID: Process_0e2hw2v
    REPORTING_PROCESS_SERVER: http://localhost:9090/reporting-service/rest
    REPORTING_PROCESS_VERSION: 1.0
  • BPMN process-flow.bpmn
    • Event Reporting Workflow

Testing

Unit Test

npm test

API

REST Report API

@POST ${reporting.server}/api/report

@BODY {
    ...@ReportEvent
}

REST Process API

@POST ${reporting.server}/api/process

@BODY {
    ...@ProcessEvent
}

REST Heart Beat API

@POST ${reporting.server}/api/definition/heart-beat

@BODY {
    ...@HeartBeatEvent
}

REST Process Definition API

@POST ${reporting.server}/api/definition

@BODY {
    ...@RegisterEvent
}

Reporting Properties

| Name | Type | Required | Default Value | Description | |----------------------|--------|----------|---------------|---------------------------------------| | processId | String | true | | Unique Process Id | | processName | String | true | | Process Name | | processVersion | String | true | 1.0 | Process Version | | server | String | true | | Process Reporting Service | | heartBeatCron | String | false | 0 */2 * ? * * | report heart beat for current service | | maxEventContentLimit | int | false | 2000 | Max event content size |

BaseReportEvent

| Name | Type | Required | Default Value | Description | |----------------|---------------|----------|---------------|---------------------------------------------------| | transactionId | String | true | | Unique Transaction Id generated by system | | processId | String | true | | Unique Process Id | | processVersion | String | true | 1.0 | Process Version | | executionId | String | true | | Process Unique execution Id generated by system | | errorMessage | String | false | | Error Message during execution | | status | ReportStatus | false | | report status STARTED, COMPLETED, ... | | eventTime | LocalDateTime | true | now | Event time generated by system | | retryCount | int | false | 0 | Retry Count | | partCount | int | false | 0 | Part Count im Event maxEventContentLimit exceeded |

ProcessEvent extends BaseReportEvent

| Name | Type | Required | Default Value | Description | |--------------------|---------------|----------|---------------|------------------------------------------------| | eventTriggeredTime | LocalDateTime | true | | Event Triggered time from source system | | startBy | String | true | | who started the process? | | boundedContext | String | true | | Bounded Context that process belong to | | eventType | String | true | | Event Type CREATED, UPDATED, DELETED, ... | | eventSource | String | true | | Event Source who throw this event? (System-A) | | runtimeId | String | true | | Runtime Id generated by system | | referenceId | String | true | | Reference Id |

ReportEvent extends BaseReportEvent

| Name | Type | Required | Default Value | Description | |-----------------------|--------|----------|---------------|----------------------------------------------| | elementId | String | true | | BPMN Element unique Id | | multipleInstanceIndex | String | true | | Task may be executed multiple times | | payload | String | true | | Event Payload like Json or primitive Objects |

HeartBeatEvent

| Name | Type | Required | Default Value | Description | |----------------|---------------|----------|---------------|--------------------------------| | processId | String | true | | Unique Process Id | | processVersion | String | true | 1.0 | Process Version | | eventTime | LocalDateTime | true | 0 | Event time generated by system |

RegisterEvent

| Name | Type | Required | Default Value | Description | |----------------|--------|----------|---------------|----------------------------------------| | processDiagram | String | true | | Process XML Diagram | | processId | String | true | | Unique Process Id | | processVersion | String | true | 1.0 | Process Version | | boundedContext | String | true | | Bounded Context that process belong to | | fileName | String | true | | Process XML Diagram file name |

ReportStatus

| Type | Description | |-----------|-----------------------------------------------------------| | QUEUED | Process has been queued | | STARTED | Process/Task has been started | | RESTARTED | Process/Task has been restarted | | COMPLETED | Process/Task has been completed | | WARNING | Task has ended with warning but Process keep running | | ERROR | Task has ended with error and Process has been terminated |

Technology Stack

  • Nodejs v16.20.2
  • Third Party Libraries
    • jest 29.5.8
    • model-converter (MIT License)
    • mustache 4.2.5
    • typescript 5.2.2
    • axios-observable 2.0.0
  • Code-Analyses
    • Sonar
    • jest coverage

License

MIT (unless noted otherwise)