@colabo-flow/s-go 0.4.1 → 1.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/dist/cjs/index.js +1799 -7
  3. package/dist/cjs/index.js.map +7 -1
  4. package/dist/esm/index.js +1748 -7
  5. package/dist/esm/index.js.map +7 -1
  6. package/dist/{cjs → types}/demo/config.d.ts +10 -10
  7. package/dist/{esm → types}/demo/create-client.d.ts +1 -1
  8. package/dist/types/demo/create-host.d.ts +7 -0
  9. package/dist/{esm → types}/demo/create-orchestrator.d.ts +1 -1
  10. package/dist/{cjs → types}/demo/send.d.ts +1 -1
  11. package/dist/types/index.d.ts +13 -0
  12. package/dist/{cjs → types}/jest.config.d.ts +3 -3
  13. package/dist/{esm → types}/lib/client/index.d.ts +4 -4
  14. package/dist/{cjs/demo/create-client.d.ts → types/lib/flowchestrator/index.d.ts} +1 -1
  15. package/dist/types/lib/flowchestrator/store/flow.store.d.ts +57 -0
  16. package/dist/{cjs/demo/create-host.d.ts → types/lib/flowchestrator/store/flow.store.test.d.ts} +1 -1
  17. package/dist/{cjs/demo/create-orchestrator.d.ts → types/lib/flowchestrator/store/flowFlowchestrator.store.test.d.ts} +1 -1
  18. package/dist/types/lib/flowchestrator/store/flowchestrator.store.d.ts +82 -0
  19. package/dist/types/lib/flowchestrator/store/index.d.ts +42 -0
  20. package/dist/{esm → types}/lib/host/index.d.ts +7 -7
  21. package/dist/{cjs → types}/lib/host/omnipresentTasks.d.ts +13 -13
  22. package/dist/types/lib/host/vos.d.ts +4 -0
  23. package/dist/{cjs → types}/lib/operators.d.ts +5 -5
  24. package/dist/{esm → types}/lib/orchestrator/index.d.ts +2 -2
  25. package/dist/{cjs → types}/lib/params.d.ts +1 -1
  26. package/dist/{cjs → types}/lib/uuid_fix.d.ts +15 -15
  27. package/dist/{cjs → types}/lib/vos.d.ts +205 -205
  28. package/dist/types/vitest.config.d.ts +2 -0
  29. package/package.json +73 -13
  30. package/dist/cjs/index.d.ts +0 -4
  31. package/dist/cjs/lib/client/index.d.ts +0 -4
  32. package/dist/cjs/lib/host/index.d.ts +0 -7
  33. package/dist/cjs/lib/host/vos.d.ts +0 -4
  34. package/dist/cjs/lib/orchestrator/index.d.ts +0 -2
  35. package/dist/cjs/tests/units/chalk/index.d.ts +0 -21
  36. package/dist/cjs/tests/units/tests-vos/tasks-and-flows.vos.d.ts +0 -20
  37. package/dist/esm/demo/config.d.ts +0 -10
  38. package/dist/esm/demo/create-host.d.ts +0 -1
  39. package/dist/esm/demo/send.d.ts +0 -1
  40. package/dist/esm/index.d.ts +0 -4
  41. package/dist/esm/jest.config.d.ts +0 -3
  42. package/dist/esm/lib/host/omnipresentTasks.d.ts +0 -13
  43. package/dist/esm/lib/host/vos.d.ts +0 -4
  44. package/dist/esm/lib/operators.d.ts +0 -5
  45. package/dist/esm/lib/params.d.ts +0 -1
  46. package/dist/esm/lib/uuid_fix.d.ts +0 -15
  47. package/dist/esm/lib/vos.d.ts +0 -205
  48. package/dist/esm/tests/units/chalk/index.d.ts +0 -21
  49. package/dist/esm/tests/units/tests-vos/tasks-and-flows.vos.d.ts +0 -20
  50. package/dist/index.d.ts +0 -221
@@ -1,10 +1,10 @@
1
- import { IReportsConfig } from "../lib/vos";
2
- export declare const reportsConfig: IReportsConfig;
3
- export declare const connectConfig: {
4
- APP_NAME: string;
5
- AMQP_URL: string;
6
- ORCHESTRATOR_QUEUE: string;
7
- HOST_HEARTBEAT_QUEUE: string;
8
- HOST_NODE_QUEUE: string;
9
- HOST_PYTHON_QUEUE: string;
10
- };
1
+ import { IReportsConfig } from "../lib/vos";
2
+ export declare const reportsConfig: IReportsConfig;
3
+ export declare const connectConfig: {
4
+ APP_NAME: string;
5
+ AMQP_URL: string;
6
+ ORCHESTRATOR_QUEUE: string;
7
+ HOST_HEARTBEAT_QUEUE: string;
8
+ HOST_NODE_QUEUE: string;
9
+ HOST_PYTHON_QUEUE: string;
10
+ };
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { IFlowTask, ITaskExecutor } from "@colabo-flow/i-core";
2
+ export declare const executorFoo: ITaskExecutor;
3
+ export declare const executorCombine: ITaskExecutor;
4
+ export declare const executorReduce: ITaskExecutor;
5
+ export declare const taskFoo: IFlowTask;
6
+ export declare const taskCombine: IFlowTask;
7
+ export declare const taskReduce: IFlowTask;
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export * from "./lib/client";
2
+ export * from "./lib/orchestrator";
3
+ export * from "./lib/host";
4
+ export * from "./lib/vos";
5
+ /**
6
+ * This is a special utility function that provides a path to this package (the file in which this function is defined).
7
+ *
8
+ * @returns path of the package
9
+ */
10
+ export declare const __getPackagePath: () => string;
11
+ export { useFlowFlowchestratorStore } from "./lib/flowchestrator/store/flowchestrator.store";
12
+ export type { IFlowFlowchestratorStoreState, IFlowFlowchestratorStoreActions } from "./lib/flowchestrator/store/flowchestrator.store";
13
+ export { useGlobalStore, type IGlobalStore, type UseGlobalStoreOptions } from "./lib/flowchestrator/store/index";
@@ -1,3 +1,3 @@
1
- import type { Config } from 'jest';
2
- declare const config: Config;
3
- export default config;
1
+ import type { Config } from 'jest';
2
+ declare const config: Config;
3
+ export default config;
@@ -1,4 +1,4 @@
1
- import { IClientExecuteTaskOptions, IColaboFlowClientData } from "../vos";
2
- export declare const clientRun: (client: IColaboFlowClientData) => Promise<void>;
3
- export declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any, options?: IClientExecuteTaskOptions) => Promise<any>;
4
- export declare const clientClose: (client: IColaboFlowClientData) => Promise<boolean>;
1
+ import { IClientExecuteTaskOptions, IColaboFlowClientData } from "../vos";
2
+ export declare const clientRun: (client: IColaboFlowClientData) => Promise<void>;
3
+ export declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any, options?: IClientExecuteTaskOptions) => Promise<any>;
4
+ export declare const clientClose: (client: IColaboFlowClientData) => Promise<boolean>;
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -0,0 +1,57 @@
1
+ import { ColaboKnAllEdgeNodeServiceExtended } from "@colabo-knalledge/i-core-services";
2
+ import { IFlowFlowchestratorStore } from "./flowchestrator.store";
3
+ import { IFlow } from '@colabo-flow/i-core';
4
+ export interface IFlowState {
5
+ /**
6
+ * All available flows
7
+ */
8
+ flows: Record<string, IFlow>;
9
+ }
10
+ /**
11
+ * Interface describing the flow store modules
12
+ */
13
+ export interface IFlowStoreModules {
14
+ modules: {
15
+ flowchestrator: IFlowFlowchestratorStore;
16
+ };
17
+ }
18
+ /**
19
+ * Interface describing the flow store mutations
20
+ */
21
+ export interface IFlowStoreMutations {
22
+ addFlow: (flow: IFlow) => void;
23
+ getFlow: (flowId: string) => IFlow | undefined;
24
+ }
25
+ /**
26
+ * Interface describing the flow store actions
27
+ */
28
+ export interface IFlowActions {
29
+ loadFlow: (flowId: string) => Promise<IFlow>;
30
+ /**
31
+ * Loads all flows from the persistent store into the flow store.
32
+ * @returns List of flows as JSON
33
+ */
34
+ loadFlows: () => Promise<IFlow[]>;
35
+ }
36
+ /**
37
+ * Flow store interface containing all the store's aspects (state, modules, mutation, and actions)
38
+ */
39
+ export type IFlowStore = IFlowState & IFlowStoreMutations & IFlowActions & IFlowStoreModules;
40
+ /** External initialization interface for the flow store */
41
+ export interface UseFlowStoreOptions {
42
+ appNameText: string;
43
+ kNodeService?: ColaboKnAllEdgeNodeServiceExtended;
44
+ useDefaultKNodeService?: boolean;
45
+ }
46
+ /** Interface that describes all the protected props of the domain store (Flow) that should be shared with sub-domain stores */
47
+ export interface IFlowStoreProtected {
48
+ appNameText: string;
49
+ kNodeService: ColaboKnAllEdgeNodeServiceExtended;
50
+ getDomainStore: () => IFlowStore;
51
+ }
52
+ /**
53
+ * Returns the Flow store either creating it if not created or just passing the previously created one
54
+ * @param _appNameText the app name text that will be used for logging
55
+ * @returns Flow store
56
+ */
57
+ export declare const useFlowStore: (options: UseFlowStoreOptions) => IFlowStore;
@@ -0,0 +1,82 @@
1
+ import { EFlowExecutionStatus, IActionPayload_ExecuteFlowInstance, IActionPayload_FLOW_INSTANCE_CREATE, IActionPayload_FLOW_INSTANCE_DELETE, IActionPayload_FLOW_INSTANCE_DEPERSIST, IActionPayload_FLOW_INSTANCE_PERSIST, IActionPayload_FLOW_INSTANCE_SET_STATUS, IActionPayload_GetAgentTokenForFlowInstance, IActionPayload_JoinFlowInstance, IActionPayload_LoadTokens, IActionPayload_MoveAllTokensToPlace, IActionPayload_MoveTokenToPlace, IFlowInstance, IFlowInstanceContext, IFlowInstanceObserver, IFlowInstancesContainer, IFlowToken, IMutationPayload__FLOW_INSTANCE_ADD, IMutationPayload__FLOW_INSTANCE_ID_UPDATE, IMutationPayload__FLOW_INSTANCE_REMOVE } from "@colabo-flow/i-core";
2
+ import { IFlowStoreProtected } from "./flow.store";
3
+ /**
4
+ * Interface describing the flow store state
5
+ */
6
+ export interface IFlowFlowchestratorStoreState {
7
+ /**
8
+ * Contains all registered observers that should be notified on flow instance ***"events"*** (like new flow instance created or a new visual task encountered)
9
+ * */
10
+ flowInstanceObservers: IFlowInstanceObserver[];
11
+ /** TODO: Should we merge IFlowInstanceContainer in IFlowInstanceContext ? */
12
+ flowInstanceContexts: Record<string, IFlowInstanceContext>;
13
+ /** -----------------
14
+ * Regular flow that are executed, either from
15
+ * 0. the flows that are loaded from the KnAllEdge store
16
+ * 1. the flows that come from routes or from
17
+ * 2. the flows initiated by some datatalks component or from
18
+ * 3. the flows provided by 3rd party components or from
19
+ * 4. the flows provided externally (through JSON schemas) or from
20
+ * 5. the programmatically constructed flows
21
+ * -----------------
22
+ */
23
+ flowInstancesContainer: IFlowInstancesContainer;
24
+ }
25
+ /**
26
+ * Interface describing the flow store mutations
27
+ */
28
+ export interface IFlowFlowchestratorStoreMutations {
29
+ addFlowInstance: (payload: IMutationPayload__FLOW_INSTANCE_ADD) => void;
30
+ removeFlowInstance: (payload: IMutationPayload__FLOW_INSTANCE_REMOVE) => void;
31
+ updateFlowInstanceId: (payload: IMutationPayload__FLOW_INSTANCE_ID_UPDATE) => void;
32
+ }
33
+ /**
34
+ * Interface describing the flow store actions
35
+ */
36
+ export interface IFlowFlowchestratorStoreActions {
37
+ /**
38
+ * Loads all (or all of the specified flow) instances from the persistent store into the flow store.
39
+ * @param flowId Flow id which instances we want to load (optional)
40
+ * @param flowInstanceNodeId Flow instance node id which instances we want to load (optional)
41
+ * @param statuses Flow instance statuses which instances we want to load (optional)
42
+ * @returns List of flow instances as JSON
43
+ */
44
+ loadFlowInstances: (flowId?: string, flowInstanceNodeId?: string, statuses?: EFlowExecutionStatus[]) => Promise<IFlowInstance[]>;
45
+ createFlowInstance: (payload: IActionPayload_FLOW_INSTANCE_CREATE) => Promise<IFlowInstance>;
46
+ deleteFlowInstance: (payload: IActionPayload_FLOW_INSTANCE_DELETE) => Promise<void>;
47
+ persistFlowInstance: (payload: IActionPayload_FLOW_INSTANCE_PERSIST) => Promise<IFlowInstance>;
48
+ depersistFlowInstance: (payload: IActionPayload_FLOW_INSTANCE_DEPERSIST) => Promise<IFlowInstance>;
49
+ executeFlowInstance: (payload: IActionPayload_ExecuteFlowInstance) => Promise<void>;
50
+ setFlowInstanceStatus: (payload: IActionPayload_FLOW_INSTANCE_SET_STATUS) => Promise<EFlowExecutionStatus>;
51
+ /**
52
+ * Join agent to a flow instance. It joins the agent to a flow instance by creating a token in the flow instance associated with the agent.
53
+ *
54
+ * It also notifies the flow instance observers about the new token created in the flow instance.
55
+ *
56
+ * @param payload - payload containing the flow instance knode ID, the place ID, agent type and ID where the agent should be joined
57
+ * @returns A promise that resolves to the knode ID of the created token.
58
+ *
59
+ * TODO: Should we return knode ID or the token ID?
60
+ */
61
+ joinAgentToFlowInstance: (payload: IActionPayload_JoinFlowInstance) => Promise<string>;
62
+ getAgentTokenForFlowInstance: (payload: IActionPayload_GetAgentTokenForFlowInstance) => Promise<IFlowToken | undefined>;
63
+ /**
64
+ * Loads token by its knode ID from the persistent store into the flow store.
65
+ * @param tokenKnodeId Token knode id
66
+ * @returns Token as JSON
67
+ */
68
+ loadToken: (tokenKnodeId: string) => Promise<IFlowToken>;
69
+ loadTokens: (payload: IActionPayload_LoadTokens) => Promise<IFlowToken[]>;
70
+ moveToken: (payload: IActionPayload_MoveTokenToPlace) => Promise<IFlowToken>;
71
+ moveAllTokens: (payload: IActionPayload_MoveAllTokensToPlace) => Promise<IFlowToken[]>;
72
+ }
73
+ /**
74
+ * Flowchestrator store interface containing all the store's aspects (state, modules, mutation, and actions)
75
+ */
76
+ export type IFlowFlowchestratorStore = IFlowFlowchestratorStoreState & IFlowFlowchestratorStoreMutations & IFlowFlowchestratorStoreActions;
77
+ /**
78
+ * Returns the Flowchestrator store either creating it if not created or just passing the previously created one
79
+ * @param flowStoreProtected internal (protected) props of the parent domain store (like KnAllEdge services, etc)
80
+ * @returns FlowChestrator store
81
+ */
82
+ export declare const useFlowFlowchestratorStore: (flowStoreProtected: IFlowStoreProtected) => IFlowFlowchestratorStore;
@@ -0,0 +1,42 @@
1
+ import { IFlowStore } from "./flow.store";
2
+ import { ColaboKnAllEdgeNodeServiceExtended } from "@colabo-knalledge/i-core-services";
3
+ export interface IGlobalState {
4
+ /**
5
+ * The version of the app
6
+ */
7
+ appVersion: string;
8
+ }
9
+ /**
10
+ * Interface describing the flow store modules
11
+ */
12
+ export interface IGlobalStoreModules {
13
+ modules: {
14
+ flow: IFlowStore;
15
+ };
16
+ }
17
+ /**
18
+ * Interface describing the global store mutations
19
+ */
20
+ export interface IGlobalStoreMutations {
21
+ }
22
+ /**
23
+ * Interface describing the global store actions
24
+ */
25
+ export interface IGlobalActions {
26
+ }
27
+ /**
28
+ * Global store interface containing all the store's aspects (state, modules, mutation, and actions)
29
+ */
30
+ export type IGlobalStore = IGlobalState & IGlobalStoreModules & IGlobalStoreMutations & IGlobalActions;
31
+ /** External initialization interface for the flow store */
32
+ export interface UseGlobalStoreOptions {
33
+ appNameText: string;
34
+ kNodeService?: ColaboKnAllEdgeNodeServiceExtended;
35
+ useDefaultKNodeService?: boolean;
36
+ }
37
+ /**
38
+ * Returns the global store either creating it if not created or just passing the previously created one
39
+ * @param _appNameText the app name text that will be used for logging
40
+ * @returns global store
41
+ */
42
+ export declare const useGlobalStore: (options: UseGlobalStoreOptions) => IGlobalStore;
@@ -1,7 +1,7 @@
1
- import { IFlowTask } from "@colabo-flow/i-core";
2
- import { IColaboFlowHostData } from "../vos";
3
- import { THostRegisterTaskExecutor } from "./vos";
4
- export declare const hostSetTitles: (host: IColaboFlowHostData) => void;
5
- export declare const hostRegisterTaskExecutor: THostRegisterTaskExecutor;
6
- export declare const hostRegisterTask: (host: IColaboFlowHostData, task: IFlowTask) => void;
7
- export declare const hostRun: (host: IColaboFlowHostData) => Promise<void>;
1
+ import { IFlowTask } from "@colabo-flow/i-core";
2
+ import { IColaboFlowHostData } from "../vos";
3
+ import { THostRegisterTaskExecutor } from "./vos";
4
+ export declare const hostSetTitles: (host: IColaboFlowHostData) => void;
5
+ export declare const hostRegisterTaskExecutor: THostRegisterTaskExecutor;
6
+ export declare const hostRegisterTask: (host: IColaboFlowHostData, task: IFlowTask) => void;
7
+ export declare const hostRun: (host: IColaboFlowHostData) => Promise<void>;
@@ -1,13 +1,13 @@
1
- /**
2
- * Here are the tasks that are embeded in any host
3
- *
4
- */
5
- import { IColaboFlowHostData } from "../vos";
6
- import { THostRegisterTask, THostRegisterTaskExecutor } from "./vos";
7
- /**
8
- * Adds all the omnipresent tasks for each host
9
- * @param host the host to which we are adding tasks
10
- * @param hostRegisterTaskExecutor function that registers executors
11
- * @param hostRegisterTask function that registers task
12
- */
13
- export declare const addOmnipresentTasks: (host: IColaboFlowHostData, hostRegisterTaskExecutor: THostRegisterTaskExecutor, hostRegisterTask: THostRegisterTask) => Promise<void>;
1
+ /**
2
+ * Here are the tasks that are embeded in any host
3
+ *
4
+ */
5
+ import { IColaboFlowHostData } from "../vos";
6
+ import { THostRegisterTask, THostRegisterTaskExecutor } from "./vos";
7
+ /**
8
+ * Adds all the omnipresent tasks for each host
9
+ * @param host the host to which we are adding tasks
10
+ * @param hostRegisterTaskExecutor function that registers executors
11
+ * @param hostRegisterTask function that registers task
12
+ */
13
+ export declare const addOmnipresentTasks: (host: IColaboFlowHostData, hostRegisterTaskExecutor: THostRegisterTaskExecutor, hostRegisterTask: THostRegisterTask) => Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { IFlowTask, ITaskExecutor } from "@colabo-flow/i-core";
2
+ import { IColaboFlowHostData } from "../vos";
3
+ export type THostRegisterTaskExecutor = (host: IColaboFlowHostData, executor: ITaskExecutor) => void;
4
+ export type THostRegisterTask = (host: IColaboFlowHostData, task: IFlowTask) => void;
@@ -1,5 +1,5 @@
1
- import { EColaboFlowGoMsgType, IColaboFlowGoMsg } from "./vos";
2
- import "./uuid_fix";
3
- import { v1 as uuidv1 } from "uuid";
4
- export { uuidv1 };
5
- export declare const createGoMsg: (sender: string, type: EColaboFlowGoMsgType) => IColaboFlowGoMsg;
1
+ import { EColaboFlowGoMsgType, IColaboFlowGoMsg } from "./vos";
2
+ import "./uuid_fix";
3
+ import { v1 as uuidv1 } from "uuid";
4
+ export { uuidv1 };
5
+ export declare const createGoMsg: (sender: string, type: EColaboFlowGoMsgType) => IColaboFlowGoMsg;
@@ -1,2 +1,2 @@
1
- import { IColaboFlowOrchestratorData } from "../vos";
2
- export declare const orchestratorRun: (orchestrator: IColaboFlowOrchestratorData) => Promise<void>;
1
+ import { IColaboFlowOrchestratorData } from "../vos";
2
+ export declare const orchestratorRun: (orchestrator: IColaboFlowOrchestratorData) => Promise<void>;
@@ -1 +1 @@
1
- export declare const MODULE_NAME: string;
1
+ export declare const MODULE_NAME: string;
@@ -1,15 +1,15 @@
1
- /**
2
- * I (@mPrinS) do not want that we depend on `react-native` as a solution for UUID crypto mismatch ...
3
- * and there is also this erro: `https://github.com/rollup/plugins/issues/1065`
4
- */
5
- declare class TypeMismatchError extends Error {
6
- }
7
- declare class QuotaExceededError extends Error {
8
- }
9
- declare const __DEV__ = true;
10
- declare let warned: boolean;
11
- declare function insecureRandomValues(array: any): any;
12
- /**
13
- * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Uint8ClampedArray} array
14
- */
15
- declare function getRandomValues(array: any): any;
1
+ /**
2
+ * I (@mPrinS) do not want that we depend on `react-native` as a solution for UUID crypto mismatch ...
3
+ * and there is also this erro: `https://github.com/rollup/plugins/issues/1065`
4
+ */
5
+ declare class TypeMismatchError extends Error {
6
+ }
7
+ declare class QuotaExceededError extends Error {
8
+ }
9
+ declare const __DEV__ = true;
10
+ declare let warned: boolean;
11
+ declare function insecureRandomValues(array: any): any;
12
+ /**
13
+ * @param {Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Uint8ClampedArray} array
14
+ */
15
+ declare function getRandomValues(array: any): any;