@hotmeshio/hotmesh 0.0.21 → 0.0.22

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/README.md CHANGED
@@ -226,9 +226,6 @@ Exchanging data between activities is central to HotMesh. For detailed informati
226
226
  ## Composition
227
227
  While the simplest graphs are linear, detailing a consistent sequence of non-cyclical activities, graphs can be layered to represent intricate business scenarios. Some can even be designed to accommodate long-lasting workflows that span months. For more details, check out the [Composable Workflow Guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/composable_workflow.md).
228
228
 
229
- ## Architectural First Principles
230
- For a deep dive into HotMesh's distributed orchestration philosophy, refer to the [Architectural First Principles Overview](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/architecture.md).
231
-
232
229
  ## Distributed Orchestration
233
230
  HotMesh is a distributed orchestration engine. Refer to the [Distributed Orchestration Guide](https://github.com/hotmeshio/sdk-typescript/blob/main/docs/distributed_orchestration.md) for a detailed breakdown of the approach.
234
231
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -161,16 +161,11 @@ class WorkflowService {
161
161
  const hotMeshClient = await worker_1.WorkerService.getHotMesh(`${namespace}.flow.signal`, { namespace });
162
162
  if (await WorkflowService.isSideEffectAllowed(hotMeshClient, 'hook')) {
163
163
  const store = asyncLocalStorage_1.asyncLocalStorage.getStore();
164
- let workflowId;
165
- let workflowTopic;
166
- if (options.workflowId && options.taskQueue && options.workflowName) {
167
- workflowId = options.workflowId;
164
+ const workflowId = options.workflowId ?? store.get('workflowId');
165
+ let workflowTopic = store.get('workflowTopic');
166
+ if (options.taskQueue && options.workflowName) {
168
167
  workflowTopic = `${options.taskQueue}-${options.workflowName}`;
169
- }
170
- else {
171
- workflowId = store.get('workflowId');
172
- workflowTopic = store.get('workflowTopic');
173
- }
168
+ } //else this is essentially recursion as the function calls itself
174
169
  const payload = {
175
170
  arguments: [...options.args],
176
171
  id: workflowId,
@@ -28,9 +28,9 @@ type WorkflowOptions = {
28
28
  };
29
29
  type HookOptions = {
30
30
  namespace?: string;
31
- taskQueue: string;
31
+ taskQueue?: string;
32
32
  args: any[];
33
- workflowId: string;
33
+ workflowId?: string;
34
34
  workflowName?: string;
35
35
  search?: WorkflowSearchOptions;
36
36
  config?: WorkflowConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -183,15 +183,11 @@ export class WorkflowService {
183
183
  const hotMeshClient = await WorkerService.getHotMesh(`${namespace}.flow.signal`, { namespace });
184
184
  if (await WorkflowService.isSideEffectAllowed(hotMeshClient, 'hook')) {
185
185
  const store = asyncLocalStorage.getStore();
186
- let workflowId: string;
187
- let workflowTopic: string;
188
- if (options.workflowId && options.taskQueue && options.workflowName) {
189
- workflowId = options.workflowId;
186
+ const workflowId = options.workflowId ?? store.get('workflowId');
187
+ let workflowTopic = store.get('workflowTopic');
188
+ if (options.taskQueue && options.workflowName) {
190
189
  workflowTopic = `${options.taskQueue}-${options.workflowName}`;
191
- } else {
192
- workflowId = store.get('workflowId');
193
- workflowTopic = store.get('workflowTopic');
194
- }
190
+ } //else this is essentially recursion as the function calls itself
195
191
  const payload = {
196
192
  arguments: [...options.args],
197
193
  id: workflowId,
package/types/durable.ts CHANGED
@@ -29,9 +29,9 @@ type WorkflowOptions = {
29
29
 
30
30
  type HookOptions = {
31
31
  namespace?: string; //'durable' is the default namespace if not provided; similar to setting `appid` in the YAML
32
- taskQueue: string;
32
+ taskQueue?: string;
33
33
  args: any[]; //input arguments to pass into the hook
34
- workflowId: string; //execution id (the job id to hook into)
34
+ workflowId?: string; //execution id (the job id to hook into)
35
35
  workflowName?: string; //the name of the user's hook function
36
36
  search?: WorkflowSearchOptions //bind additional search terms immediately before hook reentry
37
37
  config?: WorkflowConfig; //hook function constraints (backoffCoefficient, maximumAttempts, maximumInterval, initialInterval)