@hotmeshio/hotmesh 0.0.30 → 0.0.31
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/workflow.js +13 -11
- package/build/services/signaler/stream.js +0 -1
- package/build/types/durable.d.ts +2 -1
- package/package.json +1 -1
- package/services/durable/workflow.ts +14 -12
- package/services/signaler/stream.ts +0 -1
- package/types/durable.ts +2 -1
package/build/package.json
CHANGED
|
@@ -31,16 +31,16 @@ class WorkflowService {
|
|
|
31
31
|
const workflowSpan = store.get('workflowSpan');
|
|
32
32
|
const COUNTER = store.get('counter');
|
|
33
33
|
const execIndex = COUNTER.counter = COUNTER.counter + 1;
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
const childJobId = options.workflowId ?? `${
|
|
34
|
+
//NOTE: this is the hash prefix; necessary for the search index to locate the entity
|
|
35
|
+
//if the hash is a helper, a dash begins it, so it isn't indexed
|
|
36
|
+
const entityOrEmptyString = options.entity ?? '';
|
|
37
|
+
//If the workflowId is not provided, it is generated from the entity and the workflow name
|
|
38
|
+
const childJobId = options.workflowId ?? `${entityOrEmptyString}-${workflowId}-$${options.entity ?? options.workflowName}${workflowDimension}-${execIndex}`;
|
|
39
39
|
const parentWorkflowId = `${workflowId}-f`;
|
|
40
40
|
const client = new client_1.ClientService({
|
|
41
41
|
connection: await connection_1.ConnectionService.connect(worker_1.WorkerService.connection),
|
|
42
42
|
});
|
|
43
|
-
let handle = await client.workflow.getHandle(options.taskQueue, options.workflowName, childJobId, namespace);
|
|
43
|
+
let handle = await client.workflow.getHandle(options.entity ?? options.taskQueue, options.entity ?? options.workflowName, childJobId, namespace);
|
|
44
44
|
try {
|
|
45
45
|
return await handle.result(true);
|
|
46
46
|
}
|
|
@@ -73,10 +73,12 @@ class WorkflowService {
|
|
|
73
73
|
const workflowSpan = store.get('workflowSpan');
|
|
74
74
|
const COUNTER = store.get('counter');
|
|
75
75
|
const execIndex = COUNTER.counter = COUNTER.counter + 1;
|
|
76
|
-
|
|
77
|
-
const
|
|
76
|
+
//NOTE: this is the hash prefix; necessary for the search index to locate the entity
|
|
77
|
+
const entityOrEmptyString = options.entity ?? '';
|
|
78
|
+
//If the workflowId is not provided, it is generated from the entity and the workflow name
|
|
79
|
+
const childJobId = options.workflowId ?? `${entityOrEmptyString}-${workflowId}-$${options.entity ?? options.workflowName}${workflowDimension}-${execIndex}`;
|
|
78
80
|
const parentWorkflowId = `${workflowId}-f`;
|
|
79
|
-
const workflowTopic = `${options.taskQueue}-${options.workflowName}`;
|
|
81
|
+
const workflowTopic = `${options.entity ?? options.taskQueue}-${options.entity ?? options.workflowName}`;
|
|
80
82
|
try {
|
|
81
83
|
//get the status; if there is no error, return childJobId (what was spawned)
|
|
82
84
|
const hotMeshClient = await worker_1.WorkerService.getHotMesh(workflowTopic, { namespace });
|
|
@@ -247,8 +249,8 @@ class WorkflowService {
|
|
|
247
249
|
const store = asyncLocalStorage_1.asyncLocalStorage.getStore();
|
|
248
250
|
const workflowId = options.workflowId ?? store.get('workflowId');
|
|
249
251
|
let workflowTopic = store.get('workflowTopic');
|
|
250
|
-
if (options.taskQueue && options.workflowName) {
|
|
251
|
-
workflowTopic = `${options.taskQueue}-${options.workflowName}`;
|
|
252
|
+
if (options.entity || (options.taskQueue && options.workflowName)) {
|
|
253
|
+
workflowTopic = `${options.entity ?? options.taskQueue}-${options.entity ?? options.workflowName}`;
|
|
252
254
|
} //else this is essentially recursion as the function calls itself
|
|
253
255
|
const payload = {
|
|
254
256
|
arguments: [...options.args],
|
package/build/types/durable.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ type WorkflowOptions = {
|
|
|
49
49
|
taskQueue: string;
|
|
50
50
|
args: any[];
|
|
51
51
|
workflowId?: string;
|
|
52
|
-
|
|
52
|
+
entity?: string;
|
|
53
53
|
workflowName?: string;
|
|
54
54
|
parentWorkflowId?: string;
|
|
55
55
|
workflowTrace?: string;
|
|
@@ -61,6 +61,7 @@ type HookOptions = {
|
|
|
61
61
|
namespace?: string;
|
|
62
62
|
taskQueue?: string;
|
|
63
63
|
args: any[];
|
|
64
|
+
entity?: string;
|
|
64
65
|
workflowId?: string;
|
|
65
66
|
workflowName?: string;
|
|
66
67
|
search?: WorkflowSearchOptions;
|
package/package.json
CHANGED
|
@@ -39,11 +39,11 @@ export class WorkflowService {
|
|
|
39
39
|
const workflowSpan = store.get('workflowSpan');
|
|
40
40
|
const COUNTER = store.get('counter');
|
|
41
41
|
const execIndex = COUNTER.counter = COUNTER.counter + 1;
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
//
|
|
46
|
-
const childJobId = options.workflowId ?? `${
|
|
42
|
+
//NOTE: this is the hash prefix; necessary for the search index to locate the entity
|
|
43
|
+
//if the hash is a helper, a dash begins it, so it isn't indexed
|
|
44
|
+
const entityOrEmptyString = options.entity ?? '';
|
|
45
|
+
//If the workflowId is not provided, it is generated from the entity and the workflow name
|
|
46
|
+
const childJobId = options.workflowId ?? `${entityOrEmptyString}-${workflowId}-$${options.entity ?? options.workflowName}${workflowDimension}-${execIndex}`;
|
|
47
47
|
const parentWorkflowId = `${workflowId}-f`;
|
|
48
48
|
|
|
49
49
|
const client = new Client({
|
|
@@ -51,8 +51,8 @@ export class WorkflowService {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
let handle = await client.workflow.getHandle(
|
|
54
|
-
options.taskQueue,
|
|
55
|
-
options.workflowName,
|
|
54
|
+
options.entity ?? options.taskQueue,
|
|
55
|
+
options.entity ?? options.workflowName,
|
|
56
56
|
childJobId,
|
|
57
57
|
namespace,
|
|
58
58
|
);
|
|
@@ -89,10 +89,12 @@ export class WorkflowService {
|
|
|
89
89
|
const workflowSpan = store.get('workflowSpan');
|
|
90
90
|
const COUNTER = store.get('counter');
|
|
91
91
|
const execIndex = COUNTER.counter = COUNTER.counter + 1;
|
|
92
|
-
|
|
93
|
-
const
|
|
92
|
+
//NOTE: this is the hash prefix; necessary for the search index to locate the entity
|
|
93
|
+
const entityOrEmptyString = options.entity ?? '';
|
|
94
|
+
//If the workflowId is not provided, it is generated from the entity and the workflow name
|
|
95
|
+
const childJobId = options.workflowId ?? `${entityOrEmptyString}-${workflowId}-$${options.entity ?? options.workflowName}${workflowDimension}-${execIndex}`;
|
|
94
96
|
const parentWorkflowId = `${workflowId}-f`;
|
|
95
|
-
const workflowTopic = `${options.taskQueue}-${options.workflowName}`;
|
|
97
|
+
const workflowTopic = `${options.entity ?? options.taskQueue}-${options.entity ?? options.workflowName}`;
|
|
96
98
|
|
|
97
99
|
try {
|
|
98
100
|
//get the status; if there is no error, return childJobId (what was spawned)
|
|
@@ -273,8 +275,8 @@ export class WorkflowService {
|
|
|
273
275
|
const store = asyncLocalStorage.getStore();
|
|
274
276
|
const workflowId = options.workflowId ?? store.get('workflowId');
|
|
275
277
|
let workflowTopic = store.get('workflowTopic');
|
|
276
|
-
if (options.taskQueue && options.workflowName) {
|
|
277
|
-
workflowTopic = `${options.taskQueue}-${options.workflowName}`;
|
|
278
|
+
if (options.entity || (options.taskQueue && options.workflowName)) {
|
|
279
|
+
workflowTopic = `${options.entity ?? options.taskQueue}-${options.entity ?? options.workflowName}`;
|
|
278
280
|
} //else this is essentially recursion as the function calls itself
|
|
279
281
|
const payload = {
|
|
280
282
|
arguments: [...options.args],
|
package/types/durable.ts
CHANGED
|
@@ -57,7 +57,7 @@ type WorkflowOptions = {
|
|
|
57
57
|
taskQueue: string;
|
|
58
58
|
args: any[]; //input arguments to pass in
|
|
59
59
|
workflowId?: string; //execution id (the job id)
|
|
60
|
-
|
|
60
|
+
entity?: string; //If invoking a workflow, passing 'entity' will apply the value as the workflowName, taskQueue, and prefix, ensuring the FT.SEARCH index is properly scoped. This is a convenience method but limits options.
|
|
61
61
|
workflowName?: string; //the name of the user's workflow function
|
|
62
62
|
parentWorkflowId?: string; //system reserved; the id of the parent; if present the flow will not self-clean until the parent that spawned it self-cleans
|
|
63
63
|
workflowTrace?: string;
|
|
@@ -70,6 +70,7 @@ type HookOptions = {
|
|
|
70
70
|
namespace?: string; //'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
|
|
71
71
|
taskQueue?: string;
|
|
72
72
|
args: any[]; //input arguments to pass into the hook
|
|
73
|
+
entity?: string; //If invoking a hook, passing 'entity' will apply the value as the workflowName, taskQueue, and prefix, ensuring the FT.SEARCH index is properly scoped. This is a convenience method but limits options.
|
|
73
74
|
workflowId?: string; //execution id (the job id to hook into)
|
|
74
75
|
workflowName?: string; //the name of the user's hook function
|
|
75
76
|
search?: WorkflowSearchOptions //bind additional search terms immediately before hook reentry
|