@colabo-flow/s-go 0.4.0 → 1.0.0
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/CHANGELOG.md +83 -0
- package/dist/cjs/index.js +1800 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/index.js +1749 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/types/demo/config.d.ts +10 -0
- package/dist/types/demo/create-client.d.ts +1 -0
- package/dist/types/demo/create-host.d.ts +7 -0
- package/dist/types/demo/create-orchestrator.d.ts +1 -0
- package/dist/types/demo/send.d.ts +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/jest.config.d.ts +3 -0
- package/dist/types/lib/client/index.d.ts +4 -0
- package/dist/types/lib/flowchestrator/index.d.ts +1 -0
- package/dist/types/lib/flowchestrator/store/flow.store.d.ts +57 -0
- package/dist/types/lib/flowchestrator/store/flow.store.test.d.ts +1 -0
- package/dist/types/lib/flowchestrator/store/flowFlowchestrator.store.test.d.ts +1 -0
- package/dist/types/lib/flowchestrator/store/flowchestrator.store.d.ts +82 -0
- package/dist/types/lib/flowchestrator/store/index.d.ts +42 -0
- package/dist/types/lib/host/index.d.ts +7 -0
- package/dist/types/lib/host/omnipresentTasks.d.ts +13 -0
- package/dist/types/lib/host/vos.d.ts +4 -0
- package/dist/types/lib/operators.d.ts +5 -0
- package/dist/types/lib/orchestrator/index.d.ts +2 -0
- package/dist/types/lib/params.d.ts +1 -0
- package/dist/types/lib/uuid_fix.d.ts +15 -0
- package/dist/types/lib/vos.d.ts +205 -0
- package/dist/types/vitest.config.d.ts +2 -0
- package/package.json +73 -13
|
@@ -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;
|
|
@@ -0,0 +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>;
|
|
@@ -0,0 +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>;
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODULE_NAME: string;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { IFlowTask, IFlowTaskInstance, ITaskExecutor } from "@colabo-flow/i-core";
|
|
2
|
+
import { Channel } from "amqplib";
|
|
3
|
+
type ChannelModel = any;
|
|
4
|
+
export declare enum EColaboFlowGoMsgType {
|
|
5
|
+
TASK_EXECUTE_REQUEST = "TASK_EXECUTE_REQUEST",
|
|
6
|
+
TASK_EXECUTE_PROGRESS = "TASK_EXECUTE_PROGRESS",
|
|
7
|
+
TASK_EXECUTE_RESPONSE = "TASK_EXECUTE_RESPONSE",
|
|
8
|
+
TASK_INSTANCES_REPORT__REQUEST = "TASK_INSTANCES_REPORT__REQUEST",
|
|
9
|
+
TASK_INSTANCES_REPORT__RESPONSE = "TASK_INSTANCES_REPORT__RESPONSE",
|
|
10
|
+
HEARTBEAT = "HEARTBEAT"
|
|
11
|
+
}
|
|
12
|
+
/** time (in milliseconds) between two heartbeat pulses */
|
|
13
|
+
export declare const HEARTBEAT_TIME = 3000;
|
|
14
|
+
/**
|
|
15
|
+
* An interface describing messages exchanged between ColaboFlow.GO peers
|
|
16
|
+
*/
|
|
17
|
+
export interface IColaboFlowGoMsg {
|
|
18
|
+
/** unique message id */
|
|
19
|
+
id: string;
|
|
20
|
+
type: EColaboFlowGoMsgType;
|
|
21
|
+
/** unique request id, should be kept the same along the course of a same single message exchange */
|
|
22
|
+
requestId: string;
|
|
23
|
+
/** the id of the message sender */
|
|
24
|
+
sender: string;
|
|
25
|
+
/** the name of the queue to reply to (if there is a reply to the message) */
|
|
26
|
+
replyTo?: string;
|
|
27
|
+
/** the list of proxies that forwarded the message */
|
|
28
|
+
proxies: string[];
|
|
29
|
+
/**
|
|
30
|
+
* list of msg ids with the history of the replying messages
|
|
31
|
+
*/
|
|
32
|
+
msgReplyChainIds: string[];
|
|
33
|
+
/** string message that can be used for human purpose mainly */
|
|
34
|
+
msg?: string;
|
|
35
|
+
/** extension for various types of messages */
|
|
36
|
+
extension?: any;
|
|
37
|
+
}
|
|
38
|
+
/** enumeration of all the languages that are supported by ColaboFlow */
|
|
39
|
+
export declare enum EProgrammingLanguageSupported {
|
|
40
|
+
/** Javascript or its extensions that will be compiled to JavaScript eventually (TypeScript, Coffeescript) */
|
|
41
|
+
JAVASCRIPT = "JAVASCRIPT",
|
|
42
|
+
PYTHON = "PYTHON",
|
|
43
|
+
NATIVE = "NATIVE"
|
|
44
|
+
}
|
|
45
|
+
/** Message extension for the heartbeat message */
|
|
46
|
+
export interface IColaboFlowGoMsgExtension_Heartbeat {
|
|
47
|
+
/** the id of the heartbeat pulse message */
|
|
48
|
+
id: number;
|
|
49
|
+
/** the programming language that the host speaks */
|
|
50
|
+
language: EProgrammingLanguageSupported;
|
|
51
|
+
/** the list of the tasks' ids that the host implements */
|
|
52
|
+
taskIds: string[];
|
|
53
|
+
/** The queue that the host listens to */
|
|
54
|
+
queueHost: string;
|
|
55
|
+
}
|
|
56
|
+
export interface IColaboFlowGoMsgExtension_Heartbeat_Response {
|
|
57
|
+
/** the id of the heartbeat pulse message */
|
|
58
|
+
id: number;
|
|
59
|
+
/** the name of the orchestrator responding */
|
|
60
|
+
orchestratorName: string;
|
|
61
|
+
}
|
|
62
|
+
/** Message extension for the task execution request */
|
|
63
|
+
export interface IColaboFlowGoMsgExtension_TaskExecute_Request {
|
|
64
|
+
/** the id of the task we want to execute */
|
|
65
|
+
taskId: string;
|
|
66
|
+
/** input to the task we want to execute */
|
|
67
|
+
taskInput: unknown;
|
|
68
|
+
/** task execution options */
|
|
69
|
+
options: IClientExecuteTaskOptions;
|
|
70
|
+
}
|
|
71
|
+
export declare enum ETaskExecute_Progress_Status {
|
|
72
|
+
INITIALIZED = "INITIALIZED"
|
|
73
|
+
}
|
|
74
|
+
/** Message extension for the task execution response */
|
|
75
|
+
export interface IColaboFlowGoMsgExtension_TaskExecute_Progress {
|
|
76
|
+
/** the id if the task executing instance */
|
|
77
|
+
taskInstanceId: string;
|
|
78
|
+
/** the current status of the task execution */
|
|
79
|
+
status: ETaskExecute_Progress_Status;
|
|
80
|
+
/** the percentage of the task executed */
|
|
81
|
+
progress: number;
|
|
82
|
+
}
|
|
83
|
+
/** Message extension for the task execution response */
|
|
84
|
+
export interface IColaboFlowGoMsgExtension_TaskExecute_Response {
|
|
85
|
+
/** output of the executed task */
|
|
86
|
+
taskOutput: any;
|
|
87
|
+
}
|
|
88
|
+
/** Message extension for the task instances report requesting */
|
|
89
|
+
export interface IColaboFlowGoMsgExtension_TaskInstancesReport_Request {
|
|
90
|
+
reportFinalizedTaskInstances: boolean;
|
|
91
|
+
reportRunningTaskInstances: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** Message extension for the task instances report response */
|
|
94
|
+
export interface IColaboFlowGoMsgExtension_TaskInstancesReport_Response {
|
|
95
|
+
tasksInstanceInfos: Record<string, IColaboFlowGoTaskInstanceInfo>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Provides all required info about the task execution request and its progress, etc
|
|
99
|
+
*/
|
|
100
|
+
export interface IColaboFlowGoTaskInstanceInfo {
|
|
101
|
+
/** taskInstance id */
|
|
102
|
+
id: string;
|
|
103
|
+
/** task instance */
|
|
104
|
+
taskInstance: IFlowTaskInstance;
|
|
105
|
+
}
|
|
106
|
+
export interface IReportsConfig {
|
|
107
|
+
/**
|
|
108
|
+
* Should we report ColaboFlow heartbeat messages
|
|
109
|
+
* 0 - no,
|
|
110
|
+
* n>0 - yes, each n-th message of each identified worker
|
|
111
|
+
*/
|
|
112
|
+
showHeartbeatMsgs: number;
|
|
113
|
+
showReportsMsgs: boolean;
|
|
114
|
+
showExecutionMsgs: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** contains all the data that are necessary for a ColaboFlow.Go host to operate */
|
|
117
|
+
export interface IColaboFlowHostData {
|
|
118
|
+
/** reporting config data */
|
|
119
|
+
reportsConfig: IReportsConfig;
|
|
120
|
+
hostname: string;
|
|
121
|
+
appNameText?: string;
|
|
122
|
+
amqpUrl: string;
|
|
123
|
+
queueHost: string;
|
|
124
|
+
queueHostHeartbeat: string;
|
|
125
|
+
connection?: ChannelModel;
|
|
126
|
+
chHostHeartbeat?: Channel;
|
|
127
|
+
taskExecutorsAvailable: Record<string, ITaskExecutor>;
|
|
128
|
+
tasksAvailable: Record<string, IFlowTask>;
|
|
129
|
+
taskInstances: Record<string, IFlowTaskInstance>;
|
|
130
|
+
/** Provides all required info about the task execution requests (except the executed ones) coming for this particular host and its progress, etc
|
|
131
|
+
* Provides all required info about the task execution request and its progress, etc
|
|
132
|
+
* ***record key*** is the `id` of the `taskInstance`
|
|
133
|
+
*/
|
|
134
|
+
runningTaskInstancesInfos: Record<string, IColaboFlowGoTaskInstanceInfo>;
|
|
135
|
+
/** Provides all required info about the finalized (finished, stopped, failed, ...) task execution requests coming for this particular host and its progress, etc
|
|
136
|
+
* Provides all required info about the task execution request and its progress, etc
|
|
137
|
+
* ***record key*** is the `id` of the `taskInstance`
|
|
138
|
+
*/
|
|
139
|
+
finalizedTaskInstancesInfos: Record<string, IColaboFlowGoTaskInstanceInfo>;
|
|
140
|
+
}
|
|
141
|
+
/** contains all the data that are necessary for a ColaboFlow.Go client to operate */
|
|
142
|
+
export interface IColaboFlowClientData {
|
|
143
|
+
clientName: string;
|
|
144
|
+
appNameText?: string;
|
|
145
|
+
amqpUrl: string;
|
|
146
|
+
queueOrchestrator: string;
|
|
147
|
+
connection?: ChannelModel;
|
|
148
|
+
channel?: Channel;
|
|
149
|
+
taskInstances: Record<string, IFlowTaskInstance>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Options that are provided when requesting task execution from a ColaboFlow client
|
|
153
|
+
*/
|
|
154
|
+
export interface IClientExecuteTaskOptions {
|
|
155
|
+
/** host-executing-task related options */
|
|
156
|
+
hosts: {
|
|
157
|
+
/** list of hostnames that should be used for the task execution */
|
|
158
|
+
hostNames?: string[];
|
|
159
|
+
/** if set to true it will run task only if it is implemented on any of the provided hosts in `hostNames`
|
|
160
|
+
* otherwise it will treat the `hostNames` as recomendations and run on any other available host */
|
|
161
|
+
runOnlyOnEnlistedHosts?: boolean;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** Contains all the data that are necessary for a ColaboFlow.Go orchestrator to handle a node */
|
|
165
|
+
export interface IColaboFlowOrchestratorHostData {
|
|
166
|
+
/** the name of the host */
|
|
167
|
+
hostName: string;
|
|
168
|
+
/** the name of the queue host listens on */
|
|
169
|
+
queueHost: string;
|
|
170
|
+
/** tasks' ids available for a specific host */
|
|
171
|
+
taskIdsAvailable: string[];
|
|
172
|
+
/** tasks instances' ids available for a specific host */
|
|
173
|
+
taskInstanceIds: string[];
|
|
174
|
+
}
|
|
175
|
+
/** contains all the data that are necessary for a ColaboFlow.Go orchestrator to operate */
|
|
176
|
+
export interface IColaboFlowOrchestratorData {
|
|
177
|
+
/** reporting config data */
|
|
178
|
+
reportsConfig: IReportsConfig;
|
|
179
|
+
orchestratorName: string;
|
|
180
|
+
amqpUrl: string;
|
|
181
|
+
/** the heartbeat queue that the orchestrator uses to listens heartbeat (registration) for the hosts */
|
|
182
|
+
queueHostHeartbeat: string;
|
|
183
|
+
/** the orchestrator queue that the orchestrator uses to listens from the clients */
|
|
184
|
+
queueOrchestrator: string;
|
|
185
|
+
/** the channel for the clients communication */
|
|
186
|
+
clientsChannel?: Channel;
|
|
187
|
+
/** the channel for the hosts communication */
|
|
188
|
+
hostsChannel?: Channel;
|
|
189
|
+
/** infos about each host known to the orchestrator
|
|
190
|
+
* currently hosts are discovered by receiving heartbeat messages from the hosts
|
|
191
|
+
*/
|
|
192
|
+
hosts: Record<string, IColaboFlowOrchestratorHostData>;
|
|
193
|
+
/** Provides all required info about the task execution requests (except the executed ones) coming for this particular host and its progress, etc
|
|
194
|
+
* Provides all required info about the task execution request and its progress, etc
|
|
195
|
+
* ***record key*** is the `id` of the `taskInstance`
|
|
196
|
+
*/
|
|
197
|
+
runningTaskInstancesInfos: Record<string, IColaboFlowGoTaskInstanceInfo>;
|
|
198
|
+
/** Provides all required info about the finalized (finished, stopped, failed, ...) task execution requests coming for this particular host and its progress, etc
|
|
199
|
+
* Provides all required info about the task execution request and its progress, etc
|
|
200
|
+
* ***record key*** is the `id` of the `taskInstance`
|
|
201
|
+
*/
|
|
202
|
+
finalizedTaskInstancesInfos: Record<string, IColaboFlowGoTaskInstanceInfo>;
|
|
203
|
+
hostsForTaskIds: Record<string, string[]>;
|
|
204
|
+
}
|
|
205
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colabo-flow/s-go",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "ColaboFlow.Go Puzzle implementing Colabo Flow.Go service",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -13,32 +13,61 @@
|
|
|
13
13
|
"url": "https://github.com/Cha-OS/colabo"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"clean": "rm -rf dist",
|
|
17
|
+
"build": "yarn clean && yarn build:esbuild",
|
|
18
|
+
"build:rollup": "rollup -c",
|
|
19
|
+
"build:esbuild": "node esbuild.mjs",
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"test:watch": "vitest --watch",
|
|
22
|
+
"test:coverage": "vitest run --coverage",
|
|
23
|
+
"echo_name": "echo 'Paths: '; echo \"LERNA_ROOT_PATH: $LERNA_ROOT_PATH\"; echo \"LERNA_EXEC_PATH: $LERNA_EXEC_PATH\"; echo \"LERNA_PACKAGE_NAME: $LERNA_PACKAGE_NAME\"",
|
|
24
|
+
"install_deps": "yarn install",
|
|
25
|
+
"update_ver_deps": "tsx scripts/update-dependencies-versions.ts --package $LERNA_PACKAGE_NAME",
|
|
26
|
+
"deploy": "yarn install",
|
|
27
|
+
"_build": "yarn clean && yarn build:esbuild",
|
|
28
|
+
"package_build": "yarn clean && rm -rf dist && yarn build:esbuild",
|
|
29
|
+
"package_check": "tsx $COLABO_FOLDER/scripts/check-package.ts --configPath=\"$COLABO_FOLDER/scripts/config\"",
|
|
30
|
+
"package_pre_publish": "tsx $COLABO_FOLDER/scripts/pre-publish/single.ts",
|
|
31
|
+
"package_semantic_release": "npx --no-install semantic-release --no-ci --debug -e semantic-release-monorepo",
|
|
32
|
+
"package_post_publish": "tsx $COLABO_FOLDER/scripts/post-publish/single.ts",
|
|
33
|
+
"package_publish": "echo \"${npm_package_name}:package_publish ----- Publishing the package ----\"",
|
|
34
|
+
"package_update_dependencies_versions": "tsx $COLABO_FOLDER/scripts/update-dependencies-versions/single.ts",
|
|
35
|
+
"package_install": "yarn install --mutex file:/tmp/yarn-colabo.lock",
|
|
36
|
+
"package_rm_install_lock": "rm -f yarn.lock",
|
|
37
|
+
"package_install_dev": "yarn install --mutex file:/tmp/yarn-colabo.lock",
|
|
38
|
+
"package_build_dev": "yarn clean && rm -rf dist && yarn build:esbuild"
|
|
18
39
|
},
|
|
19
40
|
"main": "dist/cjs/index.js",
|
|
20
41
|
"module": "dist/esm/index.js",
|
|
21
42
|
"exports": {
|
|
22
43
|
".": {
|
|
44
|
+
"types": "./dist/types/index.d.ts",
|
|
23
45
|
"import": "./dist/esm/index.js",
|
|
24
46
|
"require": "./dist/cjs/index.js"
|
|
25
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"./package.json": "./package.json"
|
|
26
49
|
},
|
|
27
|
-
"types": "dist/index.d.ts",
|
|
28
|
-
"typings": "dist/index.d.ts",
|
|
50
|
+
"types": "dist/types/index.d.ts",
|
|
51
|
+
"typings": "dist/types/index.d.ts",
|
|
29
52
|
"files": [
|
|
30
|
-
"dist"
|
|
53
|
+
"dist",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE",
|
|
56
|
+
"CHANGELOG.md"
|
|
31
57
|
],
|
|
32
58
|
"dependencies": {
|
|
33
|
-
"@colabo-datatalks/i-cache": "^0.6.2",
|
|
34
|
-
"@colabo-flow/i-core": "^0.8.6",
|
|
35
|
-
"@colabo-transform/i-json": "^0.2.3",
|
|
36
|
-
"@colabo-utils/i-config": "^0.1.7",
|
|
37
|
-
"@colabo-utils/i-verify": "^0.1.7",
|
|
38
59
|
"amqplib": "^0.10.3",
|
|
39
60
|
"chalk": "4.1.2",
|
|
40
61
|
"ts-jest": "^29.0.3",
|
|
41
|
-
"uuid": "^
|
|
62
|
+
"uuid": "^11.0.5",
|
|
63
|
+
"@colabo-utils/i-register": "1.4.6",
|
|
64
|
+
"@colabo-flow/i-core": "1.1.1",
|
|
65
|
+
"@colabo-utils/i-verify": "1.3.5",
|
|
66
|
+
"@colabo-utils/i-config": "1.6.2",
|
|
67
|
+
"@colabo-knalledge/i-core": "1.4.2",
|
|
68
|
+
"@colabo-knalledge/i-core-services": "1.8.1",
|
|
69
|
+
"@colabo-utils/i-store": "1.0.1",
|
|
70
|
+
"@colabo-headless/i-core": "npm:@colabo-headless/i-core-backend@1.4.1"
|
|
42
71
|
},
|
|
43
72
|
"peerDependenciesLocal": {},
|
|
44
73
|
"devDependencies": {
|
|
@@ -66,7 +95,38 @@
|
|
|
66
95
|
"tslib": "^2.4.1",
|
|
67
96
|
"tslint": "^6.1.3",
|
|
68
97
|
"typescript": "^4.8.4",
|
|
98
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
99
|
+
"vitest": "^3.1.1",
|
|
69
100
|
"webpack": "^5.73.0",
|
|
70
101
|
"webpack-cli": "^4.10.0"
|
|
102
|
+
},
|
|
103
|
+
"liveDependencies": {
|
|
104
|
+
"@colabo-utils/i-register": "1.4.6",
|
|
105
|
+
"@colabo-flow/i-core": "1.1.1",
|
|
106
|
+
"@colabo-utils/i-verify": "1.3.5",
|
|
107
|
+
"@colabo-utils/i-config": "1.6.2",
|
|
108
|
+
"@colabo-knalledge/i-core": "1.4.2",
|
|
109
|
+
"@colabo-knalledge/i-core-services": "1.8.1",
|
|
110
|
+
"@colabo-utils/i-store": "1.0.1",
|
|
111
|
+
"@colabo-headless/i-core": "npm:@colabo-headless/i-core-backend@1.4.1"
|
|
112
|
+
},
|
|
113
|
+
"nx": {
|
|
114
|
+
"implicitDependencies": [
|
|
115
|
+
"@colabo-utils/i-register",
|
|
116
|
+
"@colabo-flow/i-core",
|
|
117
|
+
"@colabo-utils/i-verify",
|
|
118
|
+
"@colabo-utils/i-config",
|
|
119
|
+
"@colabo-knalledge/i-core",
|
|
120
|
+
"@colabo-knalledge/i-core-services",
|
|
121
|
+
"@colabo-utils/i-store",
|
|
122
|
+
"@colabo-headless/i-core-backend"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"build": {
|
|
126
|
+
"format": [
|
|
127
|
+
"cjs",
|
|
128
|
+
"esm"
|
|
129
|
+
],
|
|
130
|
+
"platform": "node"
|
|
71
131
|
}
|
|
72
132
|
}
|