@cnstra/core 1.8.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/dist/CNS.d.ts +6 -9
- package/dist/CNS.d.ts.map +1 -1
- package/dist/CNSCollateral.d.ts +3 -5
- package/dist/CNSCollateral.d.ts.map +1 -1
- package/dist/CNSInstanceNeuronQueue.d.ts +0 -1
- package/dist/CNSInstanceNeuronQueue.d.ts.map +1 -1
- package/dist/CNSNetwork.d.ts +16 -20
- package/dist/CNSNetwork.d.ts.map +1 -1
- package/dist/CNSNeuronActivationPump.d.ts +5 -5
- package/dist/CNSNeuronActivationPump.d.ts.map +1 -1
- package/dist/CNSPersistOptionsRegistry.d.ts +22 -0
- package/dist/CNSPersistOptionsRegistry.d.ts.map +1 -0
- package/dist/CNSStimulation.d.ts +16 -15
- package/dist/CNSStimulation.d.ts.map +1 -1
- package/dist/CNSStimulationContextStore.d.ts +6 -6
- package/dist/CNSStimulationContextStore.d.ts.map +1 -1
- package/dist/factory/index.d.ts +97 -14
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/index.cjs +285 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +283 -198
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ICNS.d.ts +5 -4
- package/dist/interfaces/ICNS.d.ts.map +1 -1
- package/dist/interfaces/ICNSCollateral.d.ts +3 -3
- package/dist/interfaces/ICNSCollateral.d.ts.map +1 -1
- package/dist/interfaces/ICNSStimulationContextStore.d.ts +5 -6
- package/dist/interfaces/ICNSStimulationContextStore.d.ts.map +1 -1
- package/dist/types/TCNSAfferentPath.d.ts +4 -0
- package/dist/types/TCNSAfferentPath.d.ts.map +1 -0
- package/dist/types/TCNSAxon.d.ts +23 -2
- package/dist/types/TCNSAxon.d.ts.map +1 -1
- package/dist/types/TCNSDendrite.d.ts +6 -6
- package/dist/types/TCNSDendrite.d.ts.map +1 -1
- package/dist/types/TCNSModality.d.ts +5 -0
- package/dist/types/TCNSModality.d.ts.map +1 -0
- package/dist/types/TCNSNeuron.d.ts +3 -3
- package/dist/types/TCNSNeuron.d.ts.map +1 -1
- package/dist/types/TCNSNeuronActivationTask.d.ts +5 -5
- package/dist/types/TCNSNeuronActivationTask.d.ts.map +1 -1
- package/dist/types/TCNSNeuronActivationTaskFailure.d.ts +2 -2
- package/dist/types/TCNSNeuronActivationTaskFailure.d.ts.map +1 -1
- package/dist/types/TCNSNeuronResponseReturn.d.ts +8 -2
- package/dist/types/TCNSNeuronResponseReturn.d.ts.map +1 -1
- package/dist/types/TCNSPersist.d.ts +16 -0
- package/dist/types/TCNSPersist.d.ts.map +1 -0
- package/dist/types/TCNSSignal.d.ts +4 -3
- package/dist/types/TCNSSignal.d.ts.map +1 -1
- package/dist/types/TCNSStimulationOptions.d.ts +7 -9
- package/dist/types/TCNSStimulationOptions.d.ts.map +1 -1
- package/dist/types/TCNSStimulationQueueItem.d.ts +4 -3
- package/dist/types/TCNSStimulationQueueItem.d.ts.map +1 -1
- package/dist/types/TCNSStimulationResponse.d.ts +10 -11
- package/dist/types/TCNSStimulationResponse.d.ts.map +1 -1
- package/dist/types/TCNSSubscriber.d.ts +1 -1
- package/dist/types/TCNSSubscriber.d.ts.map +1 -1
- package/dist/utils/CNSDrainGuard.d.ts +27 -0
- package/dist/utils/CNSDrainGuard.d.ts.map +1 -0
- package/package.json +17 -5
package/dist/types/TCNSAxon.d.ts
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
import { CNSCollateral } from '../CNSCollateral';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Axon type used by neurons.
|
|
4
|
+
*
|
|
5
|
+
* Historically this type only took a collateral name union and a single payload
|
|
6
|
+
* type, which meant every collateral on the axon was typed with the same
|
|
7
|
+
* payload (typically a union of all possible payloads).
|
|
8
|
+
*
|
|
9
|
+
* That broke property-level typing on `axon.*.createSignal(...)` – the payload
|
|
10
|
+
* parameter became a big union instead of the specific payload for that
|
|
11
|
+
* collateral.
|
|
12
|
+
*
|
|
13
|
+
* To fix this while keeping existing generic call sites mostly intact, we add
|
|
14
|
+
* a third type parameter that carries the original heterogeneous axon object.
|
|
15
|
+
* When that third parameter is provided, we preserve the precise payload type
|
|
16
|
+
* for each collateral.
|
|
17
|
+
*
|
|
18
|
+
* - `TCollateralName` / `TInputPayload` are still useful for higher-level
|
|
19
|
+
* generic constraints (unions of names / payloads).
|
|
20
|
+
* - `TCollaterals` is the concrete axon map used to recover the per-key
|
|
21
|
+
* payload types.
|
|
22
|
+
*/
|
|
23
|
+
export type TCNSAxon<TCollaterals extends Record<string, CNSCollateral<unknown>> = Record<string, CNSCollateral<unknown>>> = {
|
|
24
|
+
[K in keyof TCollaterals]: TCollaterals[K];
|
|
4
25
|
};
|
|
5
26
|
//# sourceMappingURL=TCNSAxon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSAxon.d.ts","sourceRoot":"","sources":["../../src/types/TCNSAxon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,QAAQ,CAChB,
|
|
1
|
+
{"version":3,"file":"TCNSAxon.d.ts","sourceRoot":"","sources":["../../src/types/TCNSAxon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,QAAQ,CAChB,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAChE,MAAM,EACN,aAAa,CAAC,OAAO,CAAC,CACzB,IACD;KACC,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC;CAC7C,CAAC"}
|
|
@@ -3,12 +3,12 @@ import { TCNSAxon } from './TCNSAxon';
|
|
|
3
3
|
import { TCNSLocalContextValueStore } from './TCNSLocalContextValueStore';
|
|
4
4
|
import { TNCNeuronResponseReturn } from './TCNSNeuronResponseReturn';
|
|
5
5
|
import { ICNS } from '../interfaces/ICNS';
|
|
6
|
-
export type TCNSDendrite<TContextValue,
|
|
7
|
-
collateral:
|
|
8
|
-
response: (payload:
|
|
6
|
+
export type TCNSDendrite<TContextValue, TSenderCollateral extends CNSCollateral<unknown>, TAxonType extends TCNSAxon> = {
|
|
7
|
+
collateral: TSenderCollateral;
|
|
8
|
+
response: (payload: TSenderCollateral extends CNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSLocalContextValueStore<TContextValue> & {
|
|
9
9
|
abortSignal?: AbortSignal;
|
|
10
|
-
cns?: ICNS<any, any
|
|
11
|
-
|
|
12
|
-
}) => TNCNeuronResponseReturn<
|
|
10
|
+
cns?: ICNS<any, any>;
|
|
11
|
+
stimulation?: any;
|
|
12
|
+
}) => TNCNeuronResponseReturn<TAxonType>;
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=TCNSDendrite.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSDendrite.d.ts","sourceRoot":"","sources":["../../src/types/TCNSDendrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,MAAM,YAAY,CACpB,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"TCNSDendrite.d.ts","sourceRoot":"","sources":["../../src/types/TCNSDendrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,MAAM,YAAY,CACpB,aAAa,EACb,iBAAiB,SAAS,aAAa,CAAC,OAAO,CAAC,EAEhD,SAAS,SAAS,QAAQ,IAC1B;IACA,UAAU,EAAE,iBAAiB,CAAC;IAC9B,QAAQ,EAAE,CACN,OAAO,EAAE,iBAAiB,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,EACrE,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,0BAA0B,CAAC,aAAa,CAAC,GAAG;QAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACrB,WAAW,CAAC,EAAE,GAAG,CAAC;KACrB,KACA,uBAAuB,CAAC,SAAS,CAAC,CAAC;CAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCNSModality.d.ts","sourceRoot":"","sources":["../../src/types/TCNSModality.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC5D,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TCNSAxon } from './TCNSAxon';
|
|
2
2
|
import { TCNSDendrite } from './TCNSDendrite';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
4
|
+
export type TCNSNeuron<TContextValue, TAxonType extends TCNSAxon = TCNSAxon> = {
|
|
5
5
|
axon: TAxonType;
|
|
6
6
|
/** Optional per-neuron concurrency limit. If undefined or <= 0, no limit is applied. */
|
|
7
7
|
concurrency?: number;
|
|
8
8
|
/** Optional per-neuron max processing duration in milliseconds. */
|
|
9
9
|
maxDuration?: number;
|
|
10
|
-
dendrites: TCNSDendrite<TContextValue,
|
|
10
|
+
dendrites: TCNSDendrite<TContextValue, CNSCollateral<unknown>, TAxonType>[];
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=TCNSNeuron.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSNeuron.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TCNSNeuron.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,UAAU,CAClB,aAAa,EACb,SAAS,SAAS,QAAQ,GAAG,QAAQ,IACrC;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,YAAY,CACnB,aAAa,EACb,aAAa,CAAC,OAAO,CAAC,EACtB,SAAS,CACZ,EAAE,CAAC;CACP,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
1
2
|
import { TCNSSignal } from './TCNSSignal';
|
|
2
|
-
export type TCNSNeuronActivationTask<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
input?: TCNSSignal<TCollateralName, any>;
|
|
3
|
+
export type TCNSNeuronActivationTask<TNeuron extends object = object, TCollateral extends CNSCollateral<unknown> = CNSCollateral<unknown>> = {
|
|
4
|
+
neuron: TNeuron;
|
|
5
|
+
dendriteCollateral: TCollateral;
|
|
6
|
+
input?: TCNSSignal<TCollateral>;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=TCNSNeuronActivationTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSNeuronActivationTask.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronActivationTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,wBAAwB,CAChC,
|
|
1
|
+
{"version":3,"file":"TCNSNeuronActivationTask.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronActivationTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,wBAAwB,CAChC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,WAAW,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IACnE;IACA,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,WAAW,CAAC;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TCNSNeuronActivationTask } from './TCNSNeuronActivationTask';
|
|
2
|
-
export type TCNSNeuronActivationTaskFailure<
|
|
3
|
-
task: TCNSNeuronActivationTask<
|
|
2
|
+
export type TCNSNeuronActivationTaskFailure<TNeuron extends object = object> = {
|
|
3
|
+
task: TCNSNeuronActivationTask<TNeuron>;
|
|
4
4
|
error: Error;
|
|
5
5
|
aborted: boolean;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSNeuronActivationTaskFailure.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronActivationTaskFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,+BAA+B,CACvC,
|
|
1
|
+
{"version":3,"file":"TCNSNeuronActivationTaskFailure.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronActivationTaskFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,+BAA+B,CACvC,OAAO,SAAS,MAAM,GAAG,MAAM,IAC/B;IACA,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACxC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TCNSSignal } from './TCNSSignal';
|
|
2
|
+
import { TCNSAxon } from './TCNSAxon';
|
|
3
|
+
/**
|
|
4
|
+
* Allowed return types from a neuron dendrite `response` function.
|
|
5
|
+
*
|
|
6
|
+
* Signals route by collateral object identity (not by name).
|
|
7
|
+
*/
|
|
8
|
+
export type TNCNeuronResponseReturn<TAxon extends TCNSAxon> = Promise<TCNSSignal<TAxon[keyof TAxon]>> | TCNSSignal<TAxon[keyof TAxon]> | Promise<TCNSSignal<TAxon[keyof TAxon]>[]> | TCNSSignal<TAxon[keyof TAxon]>[] | Promise<void> | void;
|
|
3
9
|
//# sourceMappingURL=TCNSNeuronResponseReturn.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSNeuronResponseReturn.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronResponseReturn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TCNSNeuronResponseReturn.d.ts","sourceRoot":"","sources":["../../src/types/TCNSNeuronResponseReturn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,CAAC,KAAK,SAAS,QAAQ,IACpD,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,GACvC,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,GAC9B,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,GACzC,UAAU,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,GAChC,OAAO,CAAC,IAAI,CAAC,GACb,IAAI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
2
|
+
import { TCNSNeuron } from './TCNSNeuron';
|
|
3
|
+
type CNSCollateralLike = InstanceType<typeof CNSCollateral>;
|
|
4
|
+
export type TCNSNeuronPersistOptions<TNeuron extends TCNSNeuron<unknown, any> = TCNSNeuron<unknown, any>> = {
|
|
5
|
+
name: string;
|
|
6
|
+
neuron: TNeuron;
|
|
7
|
+
};
|
|
8
|
+
export type TCNSCollateralPersistOptions<TCollateral extends CNSCollateralLike = CNSCollateralLike> = {
|
|
9
|
+
name: string;
|
|
10
|
+
collateral: TCollateral;
|
|
11
|
+
};
|
|
12
|
+
export type TCNSStimulationPersistOptions = {
|
|
13
|
+
stimulationId: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=TCNSPersist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCNSPersist.d.ts","sourceRoot":"","sources":["../../src/types/TCNSPersist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,KAAK,iBAAiB,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5D,MAAM,MAAM,wBAAwB,CAChC,OAAO,SAAS,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,IACnE;IACA,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,4BAA4B,CACpC,WAAW,SAAS,iBAAiB,GAAG,iBAAiB,IACzD;IACA,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
2
|
+
export type TCNSSignal<TCollateral extends CNSCollateral<unknown>> = {
|
|
3
|
+
collateral: TCollateral;
|
|
4
|
+
payload?: TCollateral extends CNSCollateral<infer P> ? P : never;
|
|
4
5
|
};
|
|
5
6
|
//# sourceMappingURL=TCNSSignal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSSignal.d.ts","sourceRoot":"","sources":["../../src/types/TCNSSignal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"TCNSSignal.d.ts","sourceRoot":"","sources":["../../src/types/TCNSSignal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,UAAU,CAAC,WAAW,SAAS,aAAa,CAAC,OAAO,CAAC,IAAI;IACjE,UAAU,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,WAAW,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACpE,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { TCNSStimulationResponse } from './TCNSStimulationResponse';
|
|
2
|
-
import { TCNSStimulationSerializedContextValue } from './TCNSStimulationSerializedContextValue';
|
|
3
1
|
import { ICNSStimulationContextStore } from '../interfaces/ICNSStimulationContextStore';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export type TCNSStimulationOptions<
|
|
2
|
+
import { TCNSModality } from './TCNSModality';
|
|
3
|
+
import { TCNSAfferentPath } from './TCNSAfferentPath';
|
|
4
|
+
export type TCNSStimulationOptions<TResponse, TStimulationContext extends Object = {}> = {
|
|
7
5
|
maxNeuronHops?: number;
|
|
8
|
-
|
|
9
|
-
onResponse?: (response: TCNSStimulationResponse<TCollateralName, TInputPayload, TOutputPayload, TNeuronName>) => void | Promise<void>;
|
|
6
|
+
onResponse?: (response: TResponse) => void | Promise<void>;
|
|
10
7
|
abortSignal?: AbortSignal;
|
|
11
|
-
stimulationId?: string;
|
|
12
|
-
contextValues?: TCNSStimulationSerializedContextValue;
|
|
13
8
|
ctx?: ICNSStimulationContextStore;
|
|
14
9
|
concurrency?: number;
|
|
10
|
+
modality?: TCNSModality;
|
|
11
|
+
afferentPath?: TCNSAfferentPath;
|
|
12
|
+
stimulationContext?: TStimulationContext;
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=TCNSStimulationOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSStimulationOptions.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TCNSStimulationOptions.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,MAAM,sBAAsB,CAC9B,SAAS,EACT,mBAAmB,SAAS,MAAM,GAAG,EAAE,IACvC;IACA,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,GAAG,CAAC,EAAE,2BAA2B,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,kBAAkB,CAAC,EAAE,mBAAmB,CAAC;CAC5C,CAAC"}
|
|
@@ -2,9 +2,10 @@ import { TCNSSubscriber } from './TCNSSubscriber';
|
|
|
2
2
|
import { TCNSSignal } from './TCNSSignal';
|
|
3
3
|
import { TCNSNeuron } from './TCNSNeuron';
|
|
4
4
|
import { TCNSDendrite } from './TCNSDendrite';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
6
|
+
export type TCNSStimulationQueueItem<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any>, TInputCollateral extends CNSCollateral<unknown> = CNSCollateral<unknown>> = {
|
|
7
|
+
neuron: TNeuron;
|
|
7
8
|
subscriber: TCNSSubscriber<TNeuron, TDendrite>;
|
|
8
|
-
inputSignal?: TCNSSignal<
|
|
9
|
+
inputSignal?: TCNSSignal<TInputCollateral>;
|
|
9
10
|
};
|
|
10
11
|
//# sourceMappingURL=TCNSStimulationQueueItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSStimulationQueueItem.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationQueueItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TCNSStimulationQueueItem.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationQueueItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,wBAAwB,CAChC,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC7C,gBAAgB,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IACxE;IACA,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC9C,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { TCNSSignal } from './TCNSSignal';
|
|
2
|
-
import { TCNSStimulationSerializedContextValue } from './TCNSStimulationSerializedContextValue';
|
|
3
2
|
import { CNSStimulation } from '../CNSStimulation';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
inputSignal?: TCNSSignal<
|
|
9
|
-
outputSignal?:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
contextValue:
|
|
3
|
+
import { TCNSModality } from './TCNSModality';
|
|
4
|
+
import { TCNSAfferentPath } from './TCNSAfferentPath';
|
|
5
|
+
import { CNSCollateral } from '../CNSCollateral';
|
|
6
|
+
export type TCNSStimulationResponse<TInputCollateral extends CNSCollateral<unknown> = CNSCollateral<unknown>, TOutputCollateral extends CNSCollateral<unknown> = CNSCollateral<unknown>> = {
|
|
7
|
+
inputSignal?: TCNSSignal<TInputCollateral>;
|
|
8
|
+
outputSignal?: TCNSSignal<TOutputCollateral>;
|
|
9
|
+
modality?: TCNSModality;
|
|
10
|
+
afferentPath?: TCNSAfferentPath;
|
|
11
|
+
contextValue: Map<object, unknown>;
|
|
13
12
|
queueLength: number;
|
|
14
|
-
stimulation: CNSStimulation<
|
|
13
|
+
stimulation: CNSStimulation<any, any>;
|
|
15
14
|
error?: Error;
|
|
16
15
|
hops?: number;
|
|
17
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSStimulationResponse.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TCNSStimulationResponse.d.ts","sourceRoot":"","sources":["../../src/types/TCNSStimulationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,uBAAuB,CAC/B,gBAAgB,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,EACxE,iBAAiB,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IACzE;IACA,WAAW,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC7C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,WAAW,EAAE,MAAM,CAAC;IAEpB,WAAW,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAEtC,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TCNSDendrite } from './TCNSDendrite';
|
|
2
2
|
import { TCNSNeuron } from './TCNSNeuron';
|
|
3
|
-
export type TCNSSubscriber<TNeuron extends TCNSNeuron<any, any
|
|
3
|
+
export type TCNSSubscriber<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any>> = {
|
|
4
4
|
neuron: TNeuron;
|
|
5
5
|
dendrite: TDendrite;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCNSSubscriber.d.ts","sourceRoot":"","sources":["../../src/types/TCNSSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,cAAc,CACtB,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"TCNSSubscriber.d.ts","sourceRoot":"","sources":["../../src/types/TCNSSubscriber.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,cAAc,CACtB,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAC7C;IACA,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CNS } from '../CNS';
|
|
2
|
+
import type { CNSCollateral } from '../CNSCollateral';
|
|
3
|
+
import type { CNSStimulation } from '../CNSStimulation';
|
|
4
|
+
import type { TCNSDendrite } from '../types/TCNSDendrite';
|
|
5
|
+
import type { TCNSNeuron } from '../types/TCNSNeuron';
|
|
6
|
+
import type { TCNSSignal } from '../types/TCNSSignal';
|
|
7
|
+
import type { TCNSStimulationOptions } from '../types/TCNSStimulationOptions';
|
|
8
|
+
import type { TCNSStimulationResponse } from '../types/TCNSStimulationResponse';
|
|
9
|
+
export type TCNSDrainGuardSignal = TCNSSignal<CNSCollateral<unknown>> | TCNSSignal<CNSCollateral<unknown>>[];
|
|
10
|
+
export type TCNSDrainGuardOptions<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any> = TCNSDendrite<any, any, any>> = {
|
|
11
|
+
cns: CNS<TNeuron, TDendrite>;
|
|
12
|
+
signal: TCNSDrainGuardSignal;
|
|
13
|
+
options?: TCNSStimulationOptions<TCNSStimulationResponse>;
|
|
14
|
+
};
|
|
15
|
+
export declare class CNSDrainGuard<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any> = TCNSDendrite<any, any, any>> {
|
|
16
|
+
private readonly guardOptions;
|
|
17
|
+
private currentStimulation?;
|
|
18
|
+
private currentDrain?;
|
|
19
|
+
private currentAbortController?;
|
|
20
|
+
constructor(guardOptions: TCNSDrainGuardOptions<TNeuron, TDendrite>);
|
|
21
|
+
isDraining(): boolean;
|
|
22
|
+
getCurrentStimulation(): CNSStimulation<TNeuron, TDendrite> | undefined;
|
|
23
|
+
drain(): Promise<void>;
|
|
24
|
+
abort(reason?: any): boolean;
|
|
25
|
+
private createStimulationOptions;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=CNSDrainGuard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CNSDrainGuard.d.ts","sourceRoot":"","sources":["../../src/utils/CNSDrainGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAEhF,MAAM,MAAM,oBAAoB,GAC1B,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAClC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;AAE3C,MAAM,MAAM,qBAAqB,CAC7B,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAC3E;IACA,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,CAAC;CAC7D,CAAC;AAEF,qBAAa,aAAa,CACtB,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAOvE,OAAO,CAAC,QAAQ,CAAC,YAAY;IALjC,OAAO,CAAC,kBAAkB,CAAC,CAAqC;IAChE,OAAO,CAAC,YAAY,CAAC,CAAgB;IACrC,OAAO,CAAC,sBAAsB,CAAC,CAAkB;gBAG5B,YAAY,EAAE,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC;IAGrE,UAAU,IAAI,OAAO;IAIrB,qBAAqB,IACtB,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,GAClC,SAAS;IAIR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqBtB,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO;IAQnC,OAAO,CAAC,wBAAwB;CAkBnC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnstra/core",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Embeddable workflow/orchestration engine for TypeScript: deterministic runs over a typed neuron graph (in-memory, zero dependencies).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"neural-network",
|
|
7
7
|
"event-flow",
|
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
"synapse",
|
|
12
12
|
"axon",
|
|
13
13
|
"dendrite",
|
|
14
|
+
"workflow",
|
|
15
|
+
"workflow-engine",
|
|
16
|
+
"orchestrator",
|
|
17
|
+
"orchestration",
|
|
18
|
+
"job-orchestration",
|
|
19
|
+
"background-jobs",
|
|
20
|
+
"etl",
|
|
21
|
+
"pipeline",
|
|
22
|
+
"retries",
|
|
23
|
+
"retry",
|
|
24
|
+
"saga",
|
|
25
|
+
"bullmq",
|
|
14
26
|
"typescript",
|
|
15
27
|
"node",
|
|
16
28
|
"browser"
|
|
@@ -38,9 +50,9 @@
|
|
|
38
50
|
"scripts": {
|
|
39
51
|
"build": "tsup && tsc --emitDeclarationOnly",
|
|
40
52
|
"build:types": "tsc --emitDeclarationOnly",
|
|
41
|
-
"prepublishOnly": "npm run build",
|
|
53
|
+
"prepublishOnly": "npm run test && npm run test:types && npm run build",
|
|
42
54
|
"test": "jest",
|
|
43
|
-
"test:types": "
|
|
55
|
+
"test:types": "npm run build:types",
|
|
44
56
|
"examples": "tsx examples/run-examples.ts"
|
|
45
57
|
},
|
|
46
58
|
"files": [
|
|
@@ -55,7 +67,7 @@
|
|
|
55
67
|
"@types/jest": "^29.5.12",
|
|
56
68
|
"jest": "^29.7.0",
|
|
57
69
|
"ts-jest": "^29.1.1",
|
|
58
|
-
"tsup": "
|
|
70
|
+
"tsup": "8.5.1",
|
|
59
71
|
"tsx": "^4.20.5",
|
|
60
72
|
"typescript": "^5.8.3"
|
|
61
73
|
}
|