From 9e969401504800ac30689f5bcdbe068bad35dab7 Mon Sep 17 00:00:00 2001 From: REllEK-IO Date: Fri, 13 Oct 2023 07:19:16 -0700 Subject: [PATCH 1/2] Data as Record --- package.json | 2 +- src/model/actionStrategy.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 980af5d..c94b40d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@phuire/strx", - "version": "0.0.31", + "version": "0.0.32", "description": "Unified Turing Machine", "main": "dist/index.js", "module": "dist/index.mjs", 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; From 117e03992d82d480c75b825b2a17e250fa30b7d0 Mon Sep 17 00:00:00 2001 From: REllEK-IO Date: Fri, 13 Oct 2023 10:00:18 -0700 Subject: [PATCH 2/2] Exported createActionWithPayloadCreator --- package.json | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c94b40d..6bc2ad9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@phuire/strx", - "version": "0.0.32", + "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,