diff --git a/package.json b/package.json index 980af5d..6bc2ad9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@phuire/strx", - "version": "0.0.31", + "version": "0.0.33", "description": "Unified Turing Machine", "main": "dist/index.js", "module": "dist/index.mjs", diff --git a/src/index.ts b/src/index.ts index 6cab667..74fcef9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ export { createActionNode } from './model/actionStrategy'; export type { Action, ActionType } from './model/action'; -export { primeAction, createAction, getSemaphore, prepareActionCreator } from './model/action'; +export { primeAction, createAction, getSemaphore, prepareActionCreator, prepareActionWithPayloadCreator } from './model/action'; export { createConcept, createQuality, defaultReducer, defaultMethodCreator } from './model/concept'; export type { Concept, diff --git a/src/model/actionStrategy.ts b/src/model/actionStrategy.ts index dabc414..1630766 100644 --- a/src/model/actionStrategy.ts +++ b/src/model/actionStrategy.ts @@ -95,12 +95,12 @@ export interface ActionNotes { */ export interface ActionStrategyParameters { topic: string; - data?: unknown; + data?: Record; initialNode: ActionNode; } export interface ActionStrategy { topic: string; - data?: unknown; + data?: Record; currentNode: ActionNode; actionList: Array; puntedStrategy?: ActionStrategy[]; @@ -139,7 +139,7 @@ function createSentence(actionNode: ActionNode, actionNotes?: ActionNotes , deci export function createStrategy( params: ActionStrategyParameters, ): ActionStrategy { - const data: unknown = params.data; + const data: Record | undefined = params.data; const currentNode: ActionNode = params.initialNode; currentNode.lastActionNode = { // This logically determines that all ActionNodes will have a Action associated. @@ -157,7 +157,7 @@ export function createStrategy( }; } -export const strategyBegin = (strategy: ActionStrategy, data?: unknown): Action => { +export const strategyBegin = (strategy: ActionStrategy, data?: Record): Action => { strategy.currentNode.action = createAction( strategy.currentNode.actionType, strategy.currentNode.payload, @@ -184,7 +184,7 @@ export const strategyBegin = (strategy: ActionStrategy, data?: unknown): Action * If no failureNode is found, will return EndOfActionStrategy instead. * @param data - OPTIONAL, if used will override the ActionStrategy's payload */ -export const strategySuccess = (_strategy: ActionStrategy, data?: unknown) => { +export const strategySuccess = (_strategy: ActionStrategy, data?: Record) => { const strategy = {..._strategy}; let nextAction: Action; const actionListEntry = createSentence( @@ -323,7 +323,7 @@ export const strategyDecide = ( _strategy: ActionStrategy, decideKey: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any - data?: unknown, + data?: Record, ) => { const strategy = {..._strategy}; let nextAction: Action;