Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/fsh-shell_pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
missing_files=""
for i in "${array[@]}"
do
[[ ${FILES_CHANGED[*]} =~ $i ]] && echo "$i file found in the changeset" || missing_files="$missing_files $i"
i_lower=$(echo "$i" | tr '[:upper:]' '[:lower:]')
[[ ${FILES_CHANGED[*]} =~ $i_lower ]] && echo "$i file found in the changeset" || missing_files="$missing_files $i"
done
echo ""
[ -z "$missing_files" ] && echo "All mandatory files have been modified" || echo "Following files $missing_files have not been modified"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.24.0] - 2026-03-23

### Added

- Add `trace` tracking to SDK messages for debugging and analytics
- Added `TraceEntry` interface for the tracing information model

## [1.23.0] - 2026-03-13

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fsm-shell",
"version": "1.23.0",
"version": "1.24.0",
"description": "client library for FSM shell",
"main": "release/fsm-shell-client.js",
"module": "release/fsm-shell-client.es.js",
Expand Down
30 changes: 18 additions & 12 deletions src/Debugger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { EventType, ALL_SHELL_EVENTS_ARRAY } from './ShellEvents';
import { EventDirection, DebugEvent } from './models/debug/debug-event';
import { MessageLogger } from './MessageLogger';
import { TraceEntry } from './models/trace/trace-entry.model';

interface DebuggableWindow extends Window {
fsmShellMessageLogger: MessageLogger | undefined;
Expand All @@ -10,29 +10,35 @@ interface DebuggableWindow extends Window {
interface Routing {
to?: string[];
from?: string[];
trace?: TraceEntry[];
}

const FSM_SHELL_DEBUG_KEY = 'cs.fsm-shell.debug';

export class Debugger {

private debugMode: boolean = false;

constructor(
private winRef: Window,
private debugId: string
) {
constructor(private winRef: Window, private debugId: string) {
if (this.debugId) {
const win = this.winRef as DebuggableWindow;
const localStorageValue = win.localStorage.getItem(FSM_SHELL_DEBUG_KEY);
if (!!localStorageValue && localStorageValue.split(',').some(it => it === debugId)) {
if (
!!localStorageValue &&
localStorageValue.split(',').some((it) => it === debugId)
) {
this.debugMode = true;
}
}
}

public traceEvent(direction: EventDirection, type: EventType, payload: any, routing: Routing, hasHandler: boolean) {
if (this.debugMode && ALL_SHELL_EVENTS_ARRAY.some(it => it === type)) {
public traceEvent(
direction: EventDirection,
type: EventType,
payload: any,
routing: Routing,
hasHandler: boolean
) {
if (this.debugMode && ALL_SHELL_EVENTS_ARRAY.some((it) => it === type)) {
const debugEvent: DebugEvent<any> = {
timestamp: new Date(),
component: this.debugId,
Expand All @@ -41,8 +47,9 @@ export class Debugger {
handled: direction === 'incoming' ? (hasHandler ? 'yes' : 'no') : 'n/a',
to: routing.to,
from: routing.from,
payload
}
trace: routing.trace,
payload,
};
this.logEvent(debugEvent);
}
}
Expand All @@ -54,5 +61,4 @@ export class Debugger {
}
win.fsmShellMessageLogger.push(debugEvent, this.debugId);
}

}
Loading
Loading