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

@cafienne/typescript-client

v0.8.2

Published

A typescript based client library for cafienne.

Downloads

7

Readme

Cafienne Typescript Client

A Typescript based set of REST APIs to run against a Cafienne Engine, typically used for testing CMMN case models.

The framework is intended to provide an easy means of building test cases against the Cafienne engine.

The Cafienne engine has the following aspects

  • Authentication can only be done through OpenID Connect protocol
  • The multi-tenant environment requires user registration before you can start running cases.

Versions

  • Version 0.8.* is tested against Cafienne Engine APIs 1.1.27.
  • Version 0.7.* is tested against Cafienne Engine APIs 1.1.24.
  • Version 0.6.* is tested against Cafienne Engine APIs 1.1.21.
  • Version 0.5.* is tested against Cafienne Engine APIs 1.1.20.
  • Version 0.4.* is tested against Cafienne Engine APIs 1.1.18.
  • Version 0.3.2 is tested against Cafienne Engine APIs 1.1.17.

Setup environment

The client library uses a simple Token Generator to generate JWT tokens that the Cafienne Engine can trust. This "IDP" generates any JWT token that we ask it to generate, and in using that the client library circumvents the Open ID Connect protocol that a normal Cafienne deployment uses. In order to make Cafienne Engine "trust" these tokens, the config settings of the engine have to be changed.

Running the Token Generator

Some of the default engine test cases also need a mailcatcher docker image.

Below is a yaml snippet that you can use to create a docker environment with this image. You can use e.g. in combination with the docker compose files in the Cafienne Getting Started repository.

    Security Alert - do not run this in production

    The IDP generates any requested token without validation.
    Using it in a production environment of the Cafienne Engine
    will run the system without proper authentication

Contact us at [email protected] if you need further help on this.

services:
  # supporting container for testing
  oidc-test-token-service:
    image: spectare/oidc-token-test-service:latest
    labels:
      component: oidc-test-token-service
    networks: 
      - dev
    expose:
      - 2377
    ports:
      - "2377:2377"
    environment:
      BIND: 0.0.0.0
      PORT: 2377
    hostname: oidc-test-token-service
    container_name: oidc-test-token-service

networks:
  dev:
    driver: bridge    

This will start a token generator on port http://localhost:2377. The next step is to change the configuration of the Cafienne Engine.

Configure Cafienne Engine to trust this IDP

    Security Alert - do not run this in production

    The IDP generates any requested token without validation.
    Using it in a production environment of the Cafienne Engine
    will run the system without proper authentication

The Cafienne Engine OpenID Connect configuration settings must be modified to point to the test IDP. Open Cafienne's local.conf file. In there, search for oidc and change it in the below

    cafienne {
        # Platform has owners that are allowed to create/disable/enable tenants
        #  This property specifies the set of user-id's that are owners
        #  This array may not be empty.
        platform {
            owners = ["admin"]
        }

        api {
            security {
                # configuration settings for OpenID Connect
                oidc {
                    connect-url = "http://localhost:2377/.well-known/openid-configuration"
                    token-url = "http://localhost:2377/token"
                    key-url = "http://localhost:2377/keys"
                    authorization-url = "http://localhost:2377/auth"
                    issuer = "http://localhost:8080"
                }
            }
        }
    }

Custom configuration

The client library exposes a few configuration options. These are stored inside the file ./config.js.

By default all logging is enabled.

var Config = {
    CafienneService: {
        // URL of backend engine
        url: 'http://localhost:2027/',
        log: {
            // Whether or not to log HTTP call information (user, url, method type, headers)
            url: true, // URL includes call number, method type and user id
            request: {
                headers: true, // Shows request headers
                body: true, // Shows request body
            },
            response: {
                status: true, // Shows response statusCode and statusMessage, including call number 
                headers: true, // Shows response headers
                body: true // Shows response body
            }
        },
        // CQRS Wait Time is the time the engine needs to process events from commands (e.g. StartCase, CompleteTask, CreateTenant) into the server side query database
        cqrsWaitTime: 5000
    },
    TokenService: {
        // URL of token service
        url: 'http://localhost:2377/token',
        // Issuer can be configured. The issuer must equal what is configure inside the Cafienne Engine
        issuer: 'http://localhost:8080',
        // Whether or not to show the tokens requested and updated in the user
        log: true
    },
    PlatformService: {
        // Whether or not to show log messages on the console from the platform APIs (e.g., whether tenant already exists or not)
        log: true
    },
    RepositoryService: {
        // Whether or not to show log messages on the console from the repository APIs (e.g., list of case definitions returned from server)
        log: true
    },
    TestCase: {
        // Whether or not to show log messages on the console (e.g. wait time messages for server side processing)
        log: true
    }
};

It holds the end points of the token service and the case engine.

Here you can also modify the issuer field of the token. In case this is changed, make sure that the change is also reflected in the local.conf of the case engine.