@hotmeshio/hotmesh 0.0.13 → 0.0.14
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/build/package.json +1 -1
- package/build/services/durable/client.d.ts +2 -2
- package/build/services/durable/client.js +2 -11
- package/build/services/engine/index.d.ts +1 -1
- package/build/services/engine/index.js +1 -1
- package/build/services/hotmesh/index.d.ts +1 -1
- package/build/types/durable.d.ts +1 -1
- package/build/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/services/durable/client.ts +4 -17
- package/services/engine/index.ts +2 -2
- package/services/hotmesh/index.ts +1 -1
- package/types/durable.ts +1 -0
- package/types/index.ts +1 -0
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkflowHandleService } from './handle';
|
|
2
2
|
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
3
|
-
import { ClientConfig, Connection,
|
|
3
|
+
import { ClientConfig, Connection, WorkflowOptions } from '../../types/durable';
|
|
4
4
|
export declare class ClientService {
|
|
5
5
|
connection: Connection;
|
|
6
6
|
options: WorkflowOptions;
|
|
@@ -9,7 +9,7 @@ export declare class ClientService {
|
|
|
9
9
|
getHotMeshClient: (worflowTopic: string) => Promise<HotMesh>;
|
|
10
10
|
workflow: {
|
|
11
11
|
start: (options: WorkflowOptions) => Promise<WorkflowHandleService>;
|
|
12
|
-
signal: (
|
|
12
|
+
signal: (signalId: string, data: Record<any, any>) => Promise<string>;
|
|
13
13
|
};
|
|
14
14
|
activateWorkflow(hotMesh: HotMesh, appId?: string, version?: string): Promise<void>;
|
|
15
15
|
static shutdown(): Promise<void>;
|
|
@@ -95,17 +95,8 @@ class ClientService {
|
|
|
95
95
|
const jobId = await hotMeshClient.pub(factory_1.SUBSCRIBES_TOPIC, payload, context);
|
|
96
96
|
return new handle_1.WorkflowHandleService(hotMeshClient, workflowTopic, jobId);
|
|
97
97
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const taskQueueName = options.taskQueue;
|
|
101
|
-
const workflowName = options.workflowName;
|
|
102
|
-
const workflowTopic = `${taskQueueName}-${workflowName}`;
|
|
103
|
-
const hotMeshClient = await this.getHotMeshClient(workflowTopic);
|
|
104
|
-
const payload = {
|
|
105
|
-
id: options.workflowId,
|
|
106
|
-
data: { ...options.data },
|
|
107
|
-
};
|
|
108
|
-
await hotMeshClient.hook(factory_1.HOOK_ID, payload);
|
|
98
|
+
signal: async (signalId, data) => {
|
|
99
|
+
return await (await this.getHotMeshClient('durable.wfs.signal')).hook('durable.wfs.signal', { id: signalId, data });
|
|
109
100
|
}
|
|
110
101
|
};
|
|
111
102
|
this.connection = config.connection;
|
|
@@ -58,7 +58,7 @@ declare class EngineService {
|
|
|
58
58
|
hasParentJob(context: JobState): boolean;
|
|
59
59
|
resolveError(metadata: JobMetadata): StreamError | undefined;
|
|
60
60
|
scrub(jobId: string): Promise<void>;
|
|
61
|
-
hook(topic: string, data: JobData, dad?: string): Promise<
|
|
61
|
+
hook(topic: string, data: JobData, dad?: string): Promise<string>;
|
|
62
62
|
hookTime(jobId: string, activityId: string): Promise<JobStatus | void>;
|
|
63
63
|
hookAll(hookTopic: string, data: JobData, keyResolver: JobStatsInput, queryFacets?: string[]): Promise<string[]>;
|
|
64
64
|
pub(topic: string, data: JobData, context?: JobState): Promise<string>;
|
|
@@ -341,7 +341,7 @@ class EngineService {
|
|
|
341
341
|
},
|
|
342
342
|
data,
|
|
343
343
|
};
|
|
344
|
-
await this.streamSignaler.publishMessage(null, streamData);
|
|
344
|
+
return await this.streamSignaler.publishMessage(null, streamData);
|
|
345
345
|
}
|
|
346
346
|
async hookTime(jobId, activityId) {
|
|
347
347
|
//the activityid is concatenated with its dimensional address (dad); split to resolve
|
|
@@ -38,7 +38,7 @@ declare class HotMeshService {
|
|
|
38
38
|
getIds(topic: string, query: JobStatsInput, queryFacets?: any[]): Promise<IdsResponse>;
|
|
39
39
|
resolveQuery(topic: string, query: JobStatsInput): Promise<GetStatsOptions>;
|
|
40
40
|
scrub(jobId: string): Promise<void>;
|
|
41
|
-
hook(topic: string, data: JobData, dad?: string): Promise<
|
|
41
|
+
hook(topic: string, data: JobData, dad?: string): Promise<string>;
|
|
42
42
|
hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets?: string[]): Promise<string[]>;
|
|
43
43
|
stop(): Promise<void>;
|
|
44
44
|
compress(terms: string[]): Promise<boolean>;
|
package/build/types/durable.d.ts
CHANGED
|
@@ -72,4 +72,4 @@ type ActivityConfig = {
|
|
|
72
72
|
maximumInterval: string;
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
export { ActivityConfig, ActivityWorkflowDataType, ClientConfig, ContextType, ConnectionConfig, Connection, NativeConnection, ProxyType, Registry, SignalOptions, WorkerConfig, WorkerOptions, WorkflowDataType, WorkflowOptions, };
|
|
75
|
+
export { ActivityConfig, ActivityWorkflowDataType, ClientConfig, ContextType, ConnectionConfig, Connection, NativeConnection, ProxyType, Registry, SignalOptions, WorkerConfig, WorkflowConfig, WorkerOptions, WorkflowDataType, WorkflowOptions, };
|
package/build/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { App, AppVID, AppTransitions, AppSubscriptions } from './app';
|
|
|
3
3
|
export { AsyncSignal } from './async';
|
|
4
4
|
export { CacheMode } from './cache';
|
|
5
5
|
export { CollationFaultType, CollationStage } from './collator';
|
|
6
|
-
export { ActivityConfig, ActivityWorkflowDataType, ClientConfig, ContextType, ConnectionConfig, Connection, NativeConnection, ProxyType, Registry, WorkerConfig, WorkerOptions, WorkflowDataType, WorkflowOptions, } from './durable';
|
|
6
|
+
export { ActivityConfig, ActivityWorkflowDataType, ClientConfig, ContextType, ConnectionConfig, Connection, NativeConnection, ProxyType, Registry, WorkflowConfig, WorkerConfig, WorkerOptions, WorkflowDataType, WorkflowOptions, } from './durable';
|
|
7
7
|
export { HookCondition, HookConditions, HookGate, HookInterface, HookRule, HookRules, HookSignal } from './hook';
|
|
8
8
|
export { RedisClientType as IORedisClientType, RedisMultiType as IORedisMultiType } from './ioredisclient';
|
|
9
9
|
export { ILogger } from './logger';
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { nanoid } from 'nanoid';
|
|
2
|
-
import { APP_ID, APP_VERSION, DEFAULT_COEFFICIENT,
|
|
2
|
+
import { APP_ID, APP_VERSION, DEFAULT_COEFFICIENT, SUBSCRIBES_TOPIC, getWorkflowYAML } from './factory';
|
|
3
3
|
import { WorkflowHandleService } from './handle';
|
|
4
4
|
import { HotMeshService as HotMesh } from '../hotmesh';
|
|
5
5
|
import {
|
|
6
6
|
ClientConfig,
|
|
7
7
|
Connection,
|
|
8
|
-
SignalOptions,
|
|
9
8
|
WorkflowOptions } from '../../types/durable';
|
|
10
9
|
import { JobState } from '../../types/job';
|
|
11
10
|
import { KeyType } from '../../modules/key';
|
|
@@ -114,22 +113,10 @@ export class ClientService {
|
|
|
114
113
|
return new WorkflowHandleService(hotMeshClient, workflowTopic, jobId);
|
|
115
114
|
},
|
|
116
115
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const taskQueueName = options.taskQueue;
|
|
120
|
-
const workflowName = options.workflowName;
|
|
121
|
-
const workflowTopic = `${taskQueueName}-${workflowName}`;
|
|
122
|
-
const hotMeshClient = await this.getHotMeshClient(workflowTopic);
|
|
123
|
-
const payload = {
|
|
124
|
-
id: options.workflowId,
|
|
125
|
-
data: { ...options.data },
|
|
126
|
-
}
|
|
127
|
-
await hotMeshClient.hook(
|
|
128
|
-
HOOK_ID,
|
|
129
|
-
payload
|
|
130
|
-
);
|
|
116
|
+
signal: async (signalId: string, data: Record<any, any>): Promise<string> => {
|
|
117
|
+
return await (await this.getHotMeshClient('durable.wfs.signal')).hook('durable.wfs.signal', { id: signalId, data });
|
|
131
118
|
}
|
|
132
|
-
}
|
|
119
|
+
}
|
|
133
120
|
|
|
134
121
|
async activateWorkflow(hotMesh: HotMesh, appId = APP_ID, version = APP_VERSION): Promise<void> {
|
|
135
122
|
const app = await hotMesh.engine.store.getApp(appId);
|
package/services/engine/index.ts
CHANGED
|
@@ -413,7 +413,7 @@ class EngineService {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// ****************** `HOOK` ACTIVITY RE-ENTRY POINT *****************
|
|
416
|
-
async hook(topic: string, data: JobData, dad?: string): Promise<
|
|
416
|
+
async hook(topic: string, data: JobData, dad?: string): Promise<string> {
|
|
417
417
|
const hookRule = await this.storeSignaler.getHookRule(topic);
|
|
418
418
|
const [aid, schema] = await this.getSchema(`.${hookRule.to}`);
|
|
419
419
|
if (!dad) {
|
|
@@ -432,7 +432,7 @@ class EngineService {
|
|
|
432
432
|
},
|
|
433
433
|
data,
|
|
434
434
|
};
|
|
435
|
-
await this.streamSignaler.publishMessage(null, streamData);
|
|
435
|
+
return await this.streamSignaler.publishMessage(null, streamData) as string;
|
|
436
436
|
}
|
|
437
437
|
async hookTime(jobId: string, activityId: string): Promise<JobStatus | void> {
|
|
438
438
|
//the activityid is concatenated with its dimensional address (dad); split to resolve
|
|
@@ -165,7 +165,7 @@ class HotMeshService {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
// ****** `HOOK` ACTIVITY RE-ENTRY POINT ******
|
|
168
|
-
async hook(topic: string, data: JobData, dad?: string): Promise<
|
|
168
|
+
async hook(topic: string, data: JobData, dad?: string): Promise<string> {
|
|
169
169
|
return await this.engine?.hook(topic, data, dad);
|
|
170
170
|
}
|
|
171
171
|
async hookAll(hookTopic: string, data: JobData, query: JobStatsInput, queryFacets: string[] = []): Promise<string[]> {
|
package/types/durable.ts
CHANGED