Skip to content

Commit

Permalink
Normalize hook return pattern, fixes StoneCypher/fsl#930
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed Jun 25, 2022
1 parent 547e355 commit b0cbe1c
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 217 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.long.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

919 merges; 114 releases
920 merges; 114 releases



Expand All @@ -18,6 +18,21 @@ Published tags:



 

 

## [Untagged] - 6/24/2022 4:55:33 PM

Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)

Author: `John Haugeland <stonecypher@gmail.com>`

* Can read data from outside, fixes StoneCypher/fsl#929




&nbsp;

&nbsp;
Expand Down
36 changes: 17 additions & 19 deletions CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

919 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
920 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)



Expand All @@ -18,6 +18,21 @@ Published tags:



&nbsp;

&nbsp;

## [Untagged] - 6/24/2022 4:55:33 PM

Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)

Author: `John Haugeland <stonecypher@gmail.com>`

* Can read data from outside, fixes StoneCypher/fsl#929




&nbsp;

&nbsp;
Expand Down Expand Up @@ -158,21 +173,4 @@ Commit [8115e8b62d8ac1cff3c7eb07afabced097f1be42](https://github.com/StoneCypher

Author: `John Haugeland <stonecypher@gmail.com>`

* yet another small commit as a trigger, this time to get the extended diff




&nbsp;

&nbsp;

<a name="5__70__31" />

## [5.70.31] - 6/18/2022 8:00:06 PM

Commit [de3d8a105aa85045a9f19ed46b4b3c5e5fb1e235](https://github.com/StoneCypher/jssm/commit/de3d8a105aa85045a9f19ed46b4b3c5e5fb1e235)

Author: `John Haugeland <stonecypher@gmail.com>`

* another small commit as a trigger, this time to get the diff
* yet another small commit as a trigger, this time to get the extended diff
32 changes: 16 additions & 16 deletions dist/es6/jssm.d.ts
Expand Up @@ -228,11 +228,11 @@ declare class Machine<mDT> {
_entry_hooks: Map<string, Function>;
_exit_hooks: Map<string, Function>;
_global_action_hooks: Map<string, Function>;
_any_action_hook: HookHandler | undefined;
_standard_transition_hook: HookHandler | undefined;
_main_transition_hook: HookHandler | undefined;
_forced_transition_hook: HookHandler | undefined;
_any_transition_hook: HookHandler | undefined;
_any_action_hook: HookHandler<mDT> | undefined;
_standard_transition_hook: HookHandler<mDT> | undefined;
_main_transition_hook: HookHandler<mDT> | undefined;
_forced_transition_hook: HookHandler<mDT> | undefined;
_any_transition_hook: HookHandler<mDT> | undefined;
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, data }: JssmGenericConfig<mDT>);
/********
*
Expand Down Expand Up @@ -538,17 +538,17 @@ declare class Machine<mDT> {
is_complete(): boolean;
state_is_complete(whichState: StateType): boolean;
has_completes(): boolean;
set_hook(HookDesc: HookDescription): void;
hook(from: string, to: string, handler: HookHandler): Machine<mDT>;
hook_action(from: string, to: string, action: string, handler: HookHandler): Machine<mDT>;
hook_global_action(action: string, handler: HookHandler): Machine<mDT>;
hook_any_action(handler: HookHandler): Machine<mDT>;
hook_standard_transition(handler: HookHandler): Machine<mDT>;
hook_main_transition(handler: HookHandler): Machine<mDT>;
hook_forced_transition(handler: HookHandler): Machine<mDT>;
hook_any_transition(handler: HookHandler): Machine<mDT>;
hook_entry(to: string, handler: HookHandler): Machine<mDT>;
hook_exit(from: string, handler: HookHandler): Machine<mDT>;
set_hook(HookDesc: HookDescription<mDT>): void;
hook(from: string, to: string, handler: HookHandler<mDT>): Machine<mDT>;
hook_action(from: string, to: string, action: string, handler: HookHandler<mDT>): Machine<mDT>;
hook_global_action(action: string, handler: HookHandler<mDT>): Machine<mDT>;
hook_any_action(handler: HookHandler<mDT>): Machine<mDT>;
hook_standard_transition(handler: HookHandler<mDT>): Machine<mDT>;
hook_main_transition(handler: HookHandler<mDT>): Machine<mDT>;
hook_forced_transition(handler: HookHandler<mDT>): Machine<mDT>;
hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
edges_between(from: string, to: string): JssmTransition<mDT>[];
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
/********
Expand Down
50 changes: 27 additions & 23 deletions dist/es6/jssm_types.d.ts
Expand Up @@ -149,57 +149,61 @@ declare type JssmCompileSeStart<DataType> = {
};
declare type JssmParseTree = Array<JssmCompileSeStart<StateType>>;
declare type JssmParseFunctionType = (string: any) => JssmParseTree;
declare type HookHandler = Function;
declare type BasicHookDescription = {
declare type BasicHookDescription<mDT> = {
kind: 'hook';
from: string;
to: string;
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type HookDescriptionWithAction = {
declare type HookDescriptionWithAction<mDT> = {
kind: 'named';
from: string;
to: string;
action: string;
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type StandardTransitionHook = {
declare type StandardTransitionHook<mDT> = {
kind: 'standard transition';
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type MainTransitionHook = {
declare type MainTransitionHook<mDT> = {
kind: 'main transition';
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type ForcedTransitionHook = {
declare type ForcedTransitionHook<mDT> = {
kind: 'forced transition';
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type AnyTransitionHook = {
declare type AnyTransitionHook<mDT> = {
kind: 'any transition';
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type GlobalActionHook = {
declare type GlobalActionHook<mDT> = {
kind: 'global action';
action: string;
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type AnyActionHook = {
declare type AnyActionHook<mDT> = {
kind: 'any action';
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type EntryHook = {
declare type EntryHook<mDT> = {
kind: 'entry';
to: string;
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type ExitHook = {
declare type ExitHook<mDT> = {
kind: 'exit';
from: string;
handler: HookHandler;
handler: HookHandler<mDT>;
};
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook;
declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT>;
declare type HookResult = true | false | undefined | void;
declare type HookContext<mDT> = {
data: mDT;
};
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult;
declare type JssmErrorExtendedInfo = {
requested_state?: StateType | undefined;
};
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler };
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookResult };
2 changes: 1 addition & 1 deletion dist/es6/version.js
@@ -1,2 +1,2 @@
const version = "5.72.1";
const version = "5.72.2";
export { version };
2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jssm.es5.cjs.nonmin.js
Expand Up @@ -16783,7 +16783,7 @@ function peg$parse(input, options) {
}
}

const version = "5.72.1";
const version = "5.72.2";

class JssmError extends Error {
constructor(machine, message, JEEI) {
Expand Down
2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jssm.es5.iife.nonmin.js
Expand Up @@ -16782,7 +16782,7 @@ var jssm = (function (exports) {
}
}

const version = "5.72.1";
const version = "5.72.2";

class JssmError extends Error {
constructor(machine, message, JEEI) {
Expand Down
34 changes: 17 additions & 17 deletions docs/docs/classes/Machine.html

Large diffs are not rendered by default.

0 comments on commit b0cbe1c

Please sign in to comment.