@colabo-flow/s-go 0.3.1 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import { IColaboFlowClientData } from "./vos";
1
+ import { IClientExecuteTaskOptions, IColaboFlowClientData } from "../vos";
2
2
  export declare const clientRun: (client: IColaboFlowClientData) => Promise<void>;
3
- export declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any) => Promise<any>;
3
+ export declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any, options?: IClientExecuteTaskOptions) => Promise<any>;
4
4
  export declare const clientClose: (client: IColaboFlowClientData) => Promise<boolean>;
@@ -1,6 +1,7 @@
1
- import { IFlowTask, ITaskExecutor } from "@colabo-flow/i-core";
2
- import { IColaboFlowHostData } from "./vos";
1
+ import { IFlowTask } from "@colabo-flow/i-core";
2
+ import { IColaboFlowHostData } from "../vos";
3
+ import { THostRegisterTaskExecutor } from "./vos";
3
4
  export declare const hostSetTitles: (host: IColaboFlowHostData) => void;
4
- export declare const hostRegisterTaskExecutor: (host: IColaboFlowHostData, executor: ITaskExecutor) => void;
5
+ export declare const hostRegisterTaskExecutor: THostRegisterTaskExecutor;
5
6
  export declare const hostRegisterTask: (host: IColaboFlowHostData, task: IFlowTask) => void;
6
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 "lib/vos";
3
+ export declare type THostRegisterTaskExecutor = (host: IColaboFlowHostData, executor: ITaskExecutor) => void;
4
+ export declare type THostRegisterTask = (host: IColaboFlowHostData, task: IFlowTask) => void;
@@ -1,2 +1,2 @@
1
- import { IColaboFlowOrchestratorData } from "./vos";
1
+ import { IColaboFlowOrchestratorData } from "../vos";
2
2
  export declare const orchestratorRun: (orchestrator: IColaboFlowOrchestratorData) => Promise<void>;
@@ -65,6 +65,8 @@ export interface IColaboFlowGoMsgExtension_TaskExecute_Request {
65
65
  taskId: string;
66
66
  /** input to the task we want to execute */
67
67
  taskInput: unknown;
68
+ /** task execution options */
69
+ options: IClientExecuteTaskOptions;
68
70
  }
69
71
  export declare enum ETaskExecute_Progress_Status {
70
72
  INITIALIZED = "INITIALIZED"
@@ -102,7 +104,12 @@ export interface IColaboFlowGoTaskInstanceInfo {
102
104
  taskInstance: IFlowTaskInstance;
103
105
  }
104
106
  export interface IReportsConfig {
105
- showHeartbeatMsgs: boolean;
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;
106
113
  showReportsMsgs: boolean;
107
114
  showExecutionMsgs: boolean;
108
115
  }
@@ -141,6 +148,19 @@ export interface IColaboFlowClientData {
141
148
  channel?: Channel;
142
149
  taskInstances: Record<string, IFlowTaskInstance>;
143
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
+ }
144
164
  /** Contains all the data that are necessary for a ColaboFlow.Go orchestrator to handle a node */
145
165
  export interface IColaboFlowOrchestratorHostData {
146
166
  /** the name of the host */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { IFlowTaskInstance, ITaskExecutor, IFlowTask } from '@colabo-flow/i-core';
2
2
  import { Channel } from 'amqplib';
3
+ import { IColaboFlowHostData as IColaboFlowHostData$1 } from 'lib/vos';
3
4
 
4
5
  declare type ChannelModel = any;
5
6
  declare enum EColaboFlowGoMsgType {
@@ -66,6 +67,8 @@ interface IColaboFlowGoMsgExtension_TaskExecute_Request {
66
67
  taskId: string;
67
68
  /** input to the task we want to execute */
68
69
  taskInput: unknown;
70
+ /** task execution options */
71
+ options: IClientExecuteTaskOptions;
69
72
  }
70
73
  declare enum ETaskExecute_Progress_Status {
71
74
  INITIALIZED = "INITIALIZED"
@@ -103,7 +106,12 @@ interface IColaboFlowGoTaskInstanceInfo {
103
106
  taskInstance: IFlowTaskInstance;
104
107
  }
105
108
  interface IReportsConfig {
106
- showHeartbeatMsgs: boolean;
109
+ /**
110
+ * Should we report ColaboFlow heartbeat messages
111
+ * 0 - no,
112
+ * n>0 - yes, each n-th message of each identified worker
113
+ */
114
+ showHeartbeatMsgs: number;
107
115
  showReportsMsgs: boolean;
108
116
  showExecutionMsgs: boolean;
109
117
  }
@@ -142,6 +150,19 @@ interface IColaboFlowClientData {
142
150
  channel?: Channel;
143
151
  taskInstances: Record<string, IFlowTaskInstance>;
144
152
  }
153
+ /**
154
+ * Options that are provided when requesting task execution from a ColaboFlow client
155
+ */
156
+ interface IClientExecuteTaskOptions {
157
+ /** host-executing-task related options */
158
+ hosts: {
159
+ /** list of hostnames that should be used for the task execution */
160
+ hostNames?: string[];
161
+ /** if set to true it will run task only if it is implemented on any of the provided hosts in `hostNames`
162
+ * otherwise it will treat the `hostNames` as recomendations and run on any other available host */
163
+ runOnlyOnEnlistedHosts?: boolean;
164
+ };
165
+ }
145
166
  /** Contains all the data that are necessary for a ColaboFlow.Go orchestrator to handle a node */
146
167
  interface IColaboFlowOrchestratorHostData {
147
168
  /** the name of the host */
@@ -185,14 +206,16 @@ interface IColaboFlowOrchestratorData {
185
206
  }
186
207
 
187
208
  declare const clientRun: (client: IColaboFlowClientData) => Promise<void>;
188
- declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any) => Promise<any>;
209
+ declare const clientExecuteTask: (client: IColaboFlowClientData, taskId: string, taskInput?: any, options?: IClientExecuteTaskOptions) => Promise<any>;
189
210
  declare const clientClose: (client: IColaboFlowClientData) => Promise<boolean>;
190
211
 
191
212
  declare const orchestratorRun: (orchestrator: IColaboFlowOrchestratorData) => Promise<void>;
192
213
 
214
+ declare type THostRegisterTaskExecutor = (host: IColaboFlowHostData$1, executor: ITaskExecutor) => void;
215
+
193
216
  declare const hostSetTitles: (host: IColaboFlowHostData) => void;
194
- declare const hostRegisterTaskExecutor: (host: IColaboFlowHostData, executor: ITaskExecutor) => void;
217
+ declare const hostRegisterTaskExecutor: THostRegisterTaskExecutor;
195
218
  declare const hostRegisterTask: (host: IColaboFlowHostData, task: IFlowTask) => void;
196
219
  declare const hostRun: (host: IColaboFlowHostData) => Promise<void>;
197
220
 
198
- export { EColaboFlowGoMsgType, EProgrammingLanguageSupported, ETaskExecute_Progress_Status, HEARTBEAT_TIME, IColaboFlowClientData, IColaboFlowGoMsg, IColaboFlowGoMsgExtension_Heartbeat, IColaboFlowGoMsgExtension_Heartbeat_Response, IColaboFlowGoMsgExtension_TaskExecute_Progress, IColaboFlowGoMsgExtension_TaskExecute_Request, IColaboFlowGoMsgExtension_TaskExecute_Response, IColaboFlowGoMsgExtension_TaskInstancesReport_Request, IColaboFlowGoMsgExtension_TaskInstancesReport_Response, IColaboFlowGoTaskInstanceInfo, IColaboFlowHostData, IColaboFlowOrchestratorData, IColaboFlowOrchestratorHostData, IReportsConfig, clientClose, clientExecuteTask, clientRun, hostRegisterTask, hostRegisterTaskExecutor, hostRun, hostSetTitles, orchestratorRun };
221
+ export { EColaboFlowGoMsgType, EProgrammingLanguageSupported, ETaskExecute_Progress_Status, HEARTBEAT_TIME, IClientExecuteTaskOptions, IColaboFlowClientData, IColaboFlowGoMsg, IColaboFlowGoMsgExtension_Heartbeat, IColaboFlowGoMsgExtension_Heartbeat_Response, IColaboFlowGoMsgExtension_TaskExecute_Progress, IColaboFlowGoMsgExtension_TaskExecute_Request, IColaboFlowGoMsgExtension_TaskExecute_Response, IColaboFlowGoMsgExtension_TaskInstancesReport_Request, IColaboFlowGoMsgExtension_TaskInstancesReport_Response, IColaboFlowGoTaskInstanceInfo, IColaboFlowHostData, IColaboFlowOrchestratorData, IColaboFlowOrchestratorHostData, IReportsConfig, clientClose, clientExecuteTask, clientRun, hostRegisterTask, hostRegisterTaskExecutor, hostRun, hostSetTitles, orchestratorRun };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colabo-flow/s-go",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "ColaboFlow.Go Puzzle implementing Colabo Flow.Go service",
5
5
  "private": false,
6
6
  "type": "module",