npm.io
0.0.18 • Published 17h ago

@bpmnkit/profiles

Licence
MIT
Version
0.0.18
Deps
1
Size
26 kB
Vulns
0
Weekly
0
Stars
8
BPMN Kit logo

@bpmnkit/profiles

Shared auth, profile storage, and client factories for the BPMN Kit CLI and proxy server

npm license typescript ai-assisted experimental

Website · Documentation · GitHub · Changelog


Overview

@bpmnkit/profiles is the shared layer that connects the casen CLI with the local proxy server. It handles profile CRUD (read/write to ~/.config/casen/config.json), creates typed CamundaClient instances from stored profiles, and resolves Authorization headers for any supported auth type.

You do not need this package if you are connecting directly to Camunda using @bpmnkit/api. It is intended for tooling that needs to share authentication state with the CLI.

Features

  • Profile CRUD — list, get, save, delete, and activate named profiles stored in ~/.config/casen/config.json
  • Client factorycreateClientFromProfile(name?) creates a ready-to-use CamundaClient from the active or named profile
  • Auth header resolutiongetAuthHeader(config) returns the correct Authorization header string for Bearer, Basic, and OAuth2 auth types
  • OAuth2 token caching — tokens are cached in memory and refreshed 60 seconds before expiry; no extra files written
  • XDG-aware — profile file path resolves to the correct platform directory (Linux XDG, macOS, Windows AppData)
  • Zero UI dependencies — no TUI or CLI dependencies; plain Node.js

Installation

npm install @bpmnkit/profiles

Quick Start

Create a CamundaClient from the active profile
import { createClientFromProfile } from "@bpmnkit/profiles"

// Uses the currently active profile from ~/.config/casen/config.json
const client = createClientFromProfile()

const instances = await client.processInstance.searchProcessInstances({})
console.log(instances.page.totalItems)
Use a named profile
const client = createClientFromProfile("production")
Resolve an auth header directly
import { getActiveProfile, getAuthHeader } from "@bpmnkit/profiles"

const profile = getActiveProfile()
if (profile) {
  const header = await getAuthHeader(profile.config)
  // "Bearer eyJ..." or "Basic dXNlcjpwYXNz" or ""
}
Manage profiles programmatically
import { listProfiles, saveProfile, useProfile, deleteProfile } from "@bpmnkit/profiles"

// List all profiles
const profiles = listProfiles()

// Save a new profile
saveProfile({
  name: "local",
  apiType: "self-managed",
  config: {
    baseUrl: "http://localhost:8080/v2",
    auth: { type: "basic", username: "admin", password: "admin" },
  },
})

// Activate a profile
useProfile("local")

// Delete a profile
deleteProfile("old-profile")

API Reference

Profile Management
Export Description
listProfiles() Returns all stored profiles
getProfile(name) Returns a profile by name, or undefined
getActiveProfile() Returns the currently active profile
getActiveName() Returns the active profile name
saveProfile(profile) Create or update a profile
deleteProfile(name) Remove a profile
useProfile(name) Set the active profile
getConfigFilePath() Returns the full path to the config file
Client Factories
Export Description
createClientFromProfile(name?) CamundaClient from the active or named profile
createAdminClientFromProfile(name?) AdminApiClient from the active or named profile
Auth
Export Description
getAuthHeader(config) Resolves an Authorization header string for any auth type

Package Description
@bpmnkit/core BPMN/DMN/Form parser, builder, layout engine
@bpmnkit/canvas Zero-dependency SVG BPMN viewer
@bpmnkit/editor Full-featured interactive BPMN editor
@bpmnkit/engine Lightweight BPMN process execution engine
@bpmnkit/feel FEEL expression language parser & evaluator
@bpmnkit/plugins 22 composable canvas plugins
@bpmnkit/api Camunda 8 REST API TypeScript client
@bpmnkit/ascii Render BPMN diagrams as Unicode ASCII art
@bpmnkit/docspack BPMN Kit docs as an offline docspack package for AI agents
@bpmnkit/ui Shared design tokens and UI components
@bpmnkit/operate Monitoring & operations frontend for Camunda clusters
@bpmnkit/connector-gen Generate connector templates from OpenAPI specs
@bpmnkit/connectors Camunda 8 OOTB connector catalog and deterministic template application
@bpmnkit/cli Camunda 8 command-line interface (casen)
@bpmnkit/proxy Local AI bridge and Camunda API proxy server
@bpmnkit/patterns Domain process patterns for BPMNKit AIKit
@bpmnkit/reebe-wasm WebAssembly BPMN engine for browser simulation
@bpmnkit/worker-client Thin Zeebe REST client for standalone workers
@bpmnkit/cli-sdk Plugin authoring SDK for the casen CLI
@bpmnkit/create-casen-plugin Scaffold a new casen CLI plugin in seconds
@bpmnkit/casen-report HTML reports from Camunda 8 incident and SLA data
@bpmnkit/casen-worker-http Example HTTP worker plugin — completes jobs with live JSONPlaceholder API data
@bpmnkit/casen-worker-ai AI task worker — classify, summarize, extract, and decide using Claude

License

MIT BPMN Kit — made by u11g

BPMN Kit

Keywords