Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepwork #74

Merged
merged 3 commits into from
Oct 10, 2023
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
4 changes: 4 additions & 0 deletions Concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type Quality = {
method?: Method;
subject?: Subject<Action>;
keyedSelectors?: KeyedSelector[];
meta?: Record<string,unknown>;
analytics?: Record<string,unknown>;
};
```
Expand All @@ -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
Expand All @@ -47,13 +49,15 @@ export type Concept = {
qualities: Quality[];
principles?: PrincipleFunction[];
mode?: Mode[];
meta?: Record<string,unknown>;
};
```
* name - The identifier of the concept to be used in conjunction with selection.
* state - Is the state of the concept of properties identified by the programmer to achieve functionality.
* 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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/concepts/counter/counter.concept.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -14,7 +14,7 @@ const initialCounterState: Counter = {
count: 0
};

export const createCounterConcept = () => {
export const createCounterConcept: ConceptCreator = () => {
return createConcept(
counterName,
initialCounterState,
Expand Down
4 changes: 2 additions & 2 deletions src/concepts/experiment/experiment.concept.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,7 +15,7 @@ const createExperimentState = (): ExperimentState => {
};
};

export const createExperimentConcept = () => {
export const createExperimentConcept: ConceptCreator = () => {
return createConcept(
experimentName,
createExperimentState(),
Expand Down
4 changes: 2 additions & 2 deletions src/concepts/ownership/ownership.concept.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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),
Expand Down
23 changes: 15 additions & 8 deletions src/model/concept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type Quality = {
method?: Method;
subject?: Subject<Action>;
keyedSelectors?: KeyedSelector[];
meta?: Record<string,unknown>;
analytics?: Record<string,unknown>;
};

Expand All @@ -38,16 +39,18 @@ export type Concept = {
qualities: Quality[];
principles?: PrincipleFunction[];
mode?: Mode[];
meta?: Record<string,unknown>;
};

// deno-lint-ignore no-explicit-any

export type ConceptCreator = (
name?: string,
state?: unknown,
qualities?: Quality[],
principles?: PrincipleFunction[],
mode?: Mode[],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
// name?: string,
// state?: unknown,
// qualities?: Quality[],
// principles?: PrincipleFunction[],
// mode?: Mode[],
// meta?: Record<string,unknown>
) => Concept;

export function createConcept(
Expand All @@ -56,13 +59,15 @@ export function createConcept(
qualities: Quality[],
principles?: PrincipleFunction[],
mode?: Mode[],
meta?: Record<string,unknown>
): Concept {
return {
name,
state,
qualities,
principles,
mode,
meta
};
}

Expand Down Expand Up @@ -109,13 +114,15 @@ export function createQuality(
methodCreator?: MethodCreator,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
keyedSelectors?: KeyedSelector[],
analytics?: Record<string,unknown>
meta?: Record<string,unknown>,
analytics?: Record<string,unknown>,
): Quality {
return {
actionType,
reducer,
methodCreator,
keyedSelectors,
meta,
analytics
};
}
Expand Down