From 496755229204e4a9eb7948e71e779510cddf28d6 Mon Sep 17 00:00:00 2001 From: REllEK-IO Date: Tue, 10 Oct 2023 13:25:24 -0700 Subject: [PATCH 1/3] Meta field --- Concept.md | 4 ++++ src/model/concept.ts | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Concept.md b/Concept.md index 67bc18c..7fc8c7e 100644 --- a/Concept.md +++ b/Concept.md @@ -28,6 +28,7 @@ export type Quality = { method?: Method; subject?: Subject; keyedSelectors?: KeyedSelector[]; + meta?: Record; analytics?: Record; }; ``` @@ -37,6 +38,7 @@ export type Quality = { * method - Is the implementation of the strategy pattern via to facilitate higher order functionality to enable additional composability. * subject - Used within the mode to inform the method of an action to be consumed. * keyedSelector - Ops-in the quality or actions into the ownership paradigm and likewise can be used to select some aspect of state from the set of concepts. +* meta - Decorator property, this is for internal use. * analytics - This field holds record entries such as time, cost, and success rate. This is for advanced systems that perform analytics to better describe ActionStrategies and their selection at run time. ## The Programmed Definition of a Concept @@ -47,6 +49,7 @@ export type Concept = { qualities: Quality[]; principles?: PrincipleFunction[]; mode?: Mode[]; + meta?: Record; }; ``` * name - The identifier of the concept to be used in conjunction with selection. @@ -54,6 +57,7 @@ export type Concept = { * qualities - Is a list of qualities that relay to the actions that mechanize the concept throughout your applications. * principles - Are observers of state of your application or that of external mechanisms. That emit some action into the axium based upon that observation. * mode - A mode is a function and point of recursion of the runtime that the concept may utilize to achieve a specific functionality necessary for that concept. This should rarely be expanded upon. +* meta - Decorator property, this is for internal use. ## Principle ``` typescript diff --git a/src/model/concept.ts b/src/model/concept.ts index 2767e20..cced087 100644 --- a/src/model/concept.ts +++ b/src/model/concept.ts @@ -29,6 +29,7 @@ export type Quality = { method?: Method; subject?: Subject; keyedSelectors?: KeyedSelector[]; + meta?: Record; analytics?: Record; }; @@ -38,16 +39,16 @@ export type Concept = { qualities: Quality[]; principles?: PrincipleFunction[]; mode?: Mode[]; + meta?: Record; }; -// deno-lint-ignore no-explicit-any - export type ConceptCreator = ( name?: string, state?: unknown, qualities?: Quality[], principles?: PrincipleFunction[], mode?: Mode[], + meta?: Record ) => Concept; export function createConcept( @@ -56,6 +57,7 @@ export function createConcept( qualities: Quality[], principles?: PrincipleFunction[], mode?: Mode[], + meta?: Record ): Concept { return { name, @@ -63,6 +65,7 @@ export function createConcept( qualities, principles, mode, + meta }; } @@ -109,13 +112,15 @@ export function createQuality( methodCreator?: MethodCreator, // eslint-disable-next-line @typescript-eslint/no-explicit-any keyedSelectors?: KeyedSelector[], - analytics?: Record + meta?: Record, + analytics?: Record, ): Quality { return { actionType, reducer, methodCreator, keyedSelectors, + meta, analytics }; } From 9cba93d4b29b3e500dfc635a49f5ecfd31404390 Mon Sep 17 00:00:00 2001 From: REllEK-IO Date: Tue, 10 Oct 2023 13:30:44 -0700 Subject: [PATCH 2/3] Adjusted ConceptCreator type --- src/concepts/counter/counter.concept.ts | 4 ++-- src/concepts/experiment/experiment.concept.ts | 4 ++-- src/concepts/ownership/ownership.concept.ts | 4 ++-- src/model/concept.ts | 14 ++++++++------ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/concepts/counter/counter.concept.ts b/src/concepts/counter/counter.concept.ts index f3b5a39..edc8076 100644 --- a/src/concepts/counter/counter.concept.ts +++ b/src/concepts/counter/counter.concept.ts @@ -1,7 +1,7 @@ import { addQuality } from './qualities/add.quality'; import { subtractQuality } from './qualities/subtract.quality'; import { setCountQuality } from './qualities/setCount.quality'; -import { createConcept } from '../../model/concept'; +import { ConceptCreator, createConcept } from '../../model/concept'; export { countingStrategy, primedCountingStrategy } from './strategies/counting.strategy'; export type Counter = { @@ -14,7 +14,7 @@ const initialCounterState: Counter = { count: 0 }; -export const createCounterConcept = () => { +export const createCounterConcept: ConceptCreator = () => { return createConcept( counterName, initialCounterState, diff --git a/src/concepts/experiment/experiment.concept.ts b/src/concepts/experiment/experiment.concept.ts index 4a28caf..058bdf4 100644 --- a/src/concepts/experiment/experiment.concept.ts +++ b/src/concepts/experiment/experiment.concept.ts @@ -1,4 +1,4 @@ -import { createConcept } from '../../model/concept'; +import { ConceptCreator, createConcept } from '../../model/concept'; import { Action } from '../../model/action'; import { checkInQuality } from './qualities/checkIn.quality'; import { experimentPrinciple } from './experiment.principle'; @@ -15,7 +15,7 @@ const createExperimentState = (): ExperimentState => { }; }; -export const createExperimentConcept = () => { +export const createExperimentConcept: ConceptCreator = () => { return createConcept( experimentName, createExperimentState(), diff --git a/src/concepts/ownership/ownership.concept.ts b/src/concepts/ownership/ownership.concept.ts index 39a3de1..ccfe96a 100644 --- a/src/concepts/ownership/ownership.concept.ts +++ b/src/concepts/ownership/ownership.concept.ts @@ -1,4 +1,4 @@ -import { createConcept } from '../../model/concept'; +import { ConceptCreator, createConcept } from '../../model/concept'; import { Action } from '../../model/action'; import { ownershipMode } from './ownership.mode'; import { initializeOwnershipQuality } from './qualities/initializeOwnership.quality'; @@ -31,7 +31,7 @@ const createOwnershipState = (isResponsibleForMode?: boolean): OwnershipState => }; }; -export const createOwnershipConcept = (isResponsibleForMode?: boolean) => { +export const createOwnershipConcept: ConceptCreator = (isResponsibleForMode?: boolean) => { return createConcept( ownershipName, createOwnershipState(isResponsibleForMode ? isResponsibleForMode : true), diff --git a/src/model/concept.ts b/src/model/concept.ts index cced087..5fcebcf 100644 --- a/src/model/concept.ts +++ b/src/model/concept.ts @@ -43,12 +43,14 @@ export type Concept = { }; export type ConceptCreator = ( - name?: string, - state?: unknown, - qualities?: Quality[], - principles?: PrincipleFunction[], - mode?: Mode[], - meta?: Record + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ...args: any[] + // name?: string, + // state?: unknown, + // qualities?: Quality[], + // principles?: PrincipleFunction[], + // mode?: Mode[], + // meta?: Record ) => Concept; export function createConcept( From a94803cdcc6e7e79b9ee9a43555bd4afb804744f Mon Sep 17 00:00:00 2001 From: REllEK-IO Date: Tue, 10 Oct 2023 13:31:15 -0700 Subject: [PATCH 3/3] Version Bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88b1d80..1f1c10a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@phuire/strx", - "version": "0.0.21", + "version": "0.0.22", "description": "Unified Turing Machine", "main": "dist/index.js", "module": "dist/index.mjs",