@hotmeshio/hotmesh 0.1.6 → 0.1.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "test:durable:signal": "NODE_ENV=test jest ./tests/durable/signal/index.test.ts --detectOpenHandles --forceExit --verbose",
42
42
  "test:durable:unknown": "NODE_ENV=test jest ./tests/durable/unknown/index.test.ts --detectOpenHandles --forceExit --verbose",
43
43
  "test:emit": "NODE_ENV=test jest ./tests/functional/emit/index.test.ts --detectOpenHandles --forceExit --verbose",
44
- "test:expired": "NODE_ENV=test jest ./tests/functional/expired/index.test.ts --detectOpenHandles --forceExit --verbose",
44
+ "test:pending": "NODE_ENV=test jest ./tests/functional/pending/index.test.ts --detectOpenHandles --forceExit --verbose",
45
45
  "test:functional": "NODE_ENV=test jest ./tests/functional/*/index.test.ts --detectOpenHandles --forceExit --verbose",
46
46
  "test:hmsh": "NODE_ENV=test jest ./tests/functional/index.test.ts --detectOpenHandles --verbose",
47
47
  "test:hook": "NODE_ENV=test jest ./tests/functional/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
@@ -25,16 +25,16 @@ class Trigger extends activity_1.Activity {
25
25
  telemetry.startJobSpan();
26
26
  telemetry.startActivitySpan(this.leg);
27
27
  this.mapJobData();
28
- await this.setStateNX(options?.expired ? -1 : undefined);
28
+ await this.setStateNX(options?.pending ? -1 : undefined);
29
29
  this.adjacencyList = await this.filterAdjacent();
30
- await this.setStatus(options?.expired ? -1 : this.adjacencyList.length);
30
+ await this.setStatus(options?.pending ? -1 : this.adjacencyList.length);
31
31
  this.bindSearchData(options);
32
32
  this.bindMarkerData(options);
33
33
  const multi = this.store.getMulti();
34
34
  await this.setState(multi);
35
35
  await this.setStats(multi);
36
- if (options?.expired) {
37
- await this.setExpired(options?.expired, multi);
36
+ if (options?.pending) {
37
+ await this.setExpired(options?.pending, multi);
38
38
  }
39
39
  else {
40
40
  await this.registerJobDependency(multi);
@@ -47,8 +47,7 @@ class Trigger extends activity_1.Activity {
47
47
  const jobStatus = Number(this.context.metadata.js);
48
48
  telemetry.setJobAttributes({ 'app.job.jss': jobStatus });
49
49
  const attrs = { 'app.job.jss': jobStatus };
50
- //only transition if not inited in an expired state
51
- //todo: enable resume from expired state
50
+ //todo: enable resume from pending state
52
51
  if (jobStatus !== -1) {
53
52
  const messageIds = await this.transition(this.adjacencyList, jobStatus);
54
53
  if (messageIds.length) {
@@ -76,7 +76,7 @@ class ClientService {
76
76
  const jobId = await hotMeshClient.pub(`${options.namespace ?? factory_1.APP_ID}.execute`, payload, context, {
77
77
  search: options?.search?.data,
78
78
  marker: options?.marker,
79
- expired: options?.expired,
79
+ pending: options?.pending,
80
80
  });
81
81
  return new handle_1.WorkflowHandleService(hotMeshClient, workflowTopic, jobId);
82
82
  },
@@ -40,23 +40,23 @@ class ExporterService {
40
40
  //transitions
41
41
  this.inflateTransition(match, value, transitionsObject);
42
42
  }
43
- else if (key.length === 3) {
44
- //state
45
- state[this.inflateKey(key)] = serializer_1.SerializerService.fromString(value);
46
- }
47
43
  else if (key.startsWith('_')) {
48
44
  //data
49
45
  data[key.substring(1)] = value;
50
46
  }
51
47
  else if (key.startsWith('-')) {
52
48
  //timeline
53
- const keyParts = this.keyToObject(key); //key parts have meaning
49
+ const keyParts = this.keyToObject(key);
54
50
  timeline.push({
55
51
  ...keyParts,
56
52
  key,
57
53
  value: this.resolveValue(value, options.values),
58
54
  });
59
55
  }
56
+ else if (key.length === 3) {
57
+ //state
58
+ state[this.inflateKey(key)] = serializer_1.SerializerService.fromString(value);
59
+ }
60
60
  });
61
61
  return this.filterFields({
62
62
  data: (0, utils_1.restoreHierarchy)(data),
@@ -261,16 +261,16 @@ type WorkflowOptions = {
261
261
  */
262
262
  await?: boolean;
263
263
  /**
264
- * If provided, the job will initialize in an expired state, reserving
264
+ * If provided, the job will initialize in a pending state, reserving
265
265
  * only the job ID (HSETNX) and persisting search and marker (if provided).
266
266
  * If a `resume` signal is sent before the specified number of seconds,
267
- * the job will resume as normal, transition to the adjacent children
267
+ * the job will resume as normal, transitioning to the adjacent children
268
268
  * of the trigger. If the job is not resumed within the number
269
269
  * of seconds specified, the job will be scrubbed. No dependencies
270
- * are added for a job in an expired state; however, dependencies
270
+ * are added for a job in a pending state; however, dependencies
271
271
  * will be added after the job is resumed if relevant.
272
272
  */
273
- expired?: number;
273
+ pending?: number;
274
274
  };
275
275
  /**
276
276
  * Options for setting up a hook.
@@ -78,16 +78,16 @@ type ExtensionType = {
78
78
  */
79
79
  marker?: StringStringType;
80
80
  /**
81
- * If provided, the job will initialize in an expired state, reserving
81
+ * If provided, the job will initialize in a pending state, reserving
82
82
  * only the job ID (HSETNX) and persisting search and marker (if provided).
83
83
  * If a `resume` signal is sent before the specified number of seconds,
84
- * the job will resume as normal, transition the the adjacent children
85
- * of the trigger. If the job is not resumed within the
86
- * number of seconds specified, the job will be scrubbed. No dependencies
87
- * are added for a job in an expired state; however, dependencies will be
88
- * added after the job is resumed if relevant.
84
+ * the job will resume as normal, transitioning to the adjacent children
85
+ * of the trigger. If the job is not resumed within the number
86
+ * of seconds specified, the job will be scrubbed. No dependencies
87
+ * are added for a job in a pending state; however, dependencies
88
+ * will be added after the job is resumed if relevant.
89
89
  */
90
- expired?: number;
90
+ pending?: number;
91
91
  };
92
92
  /**
93
93
  * job_status semaphore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/hotmesh",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Unbreakable Workflows",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "test:durable:signal": "NODE_ENV=test jest ./tests/durable/signal/index.test.ts --detectOpenHandles --forceExit --verbose",
42
42
  "test:durable:unknown": "NODE_ENV=test jest ./tests/durable/unknown/index.test.ts --detectOpenHandles --forceExit --verbose",
43
43
  "test:emit": "NODE_ENV=test jest ./tests/functional/emit/index.test.ts --detectOpenHandles --forceExit --verbose",
44
- "test:expired": "NODE_ENV=test jest ./tests/functional/expired/index.test.ts --detectOpenHandles --forceExit --verbose",
44
+ "test:pending": "NODE_ENV=test jest ./tests/functional/pending/index.test.ts --detectOpenHandles --forceExit --verbose",
45
45
  "test:functional": "NODE_ENV=test jest ./tests/functional/*/index.test.ts --detectOpenHandles --forceExit --verbose",
46
46
  "test:hmsh": "NODE_ENV=test jest ./tests/functional/index.test.ts --detectOpenHandles --verbose",
47
47
  "test:hook": "NODE_ENV=test jest ./tests/functional/hook/index.test.ts --detectOpenHandles --forceExit --verbose",
package/types/durable.ts CHANGED
@@ -315,16 +315,16 @@ type WorkflowOptions = {
315
315
  await?: boolean;
316
316
 
317
317
  /**
318
- * If provided, the job will initialize in an expired state, reserving
318
+ * If provided, the job will initialize in a pending state, reserving
319
319
  * only the job ID (HSETNX) and persisting search and marker (if provided).
320
320
  * If a `resume` signal is sent before the specified number of seconds,
321
- * the job will resume as normal, transition to the adjacent children
321
+ * the job will resume as normal, transitioning to the adjacent children
322
322
  * of the trigger. If the job is not resumed within the number
323
323
  * of seconds specified, the job will be scrubbed. No dependencies
324
- * are added for a job in an expired state; however, dependencies
324
+ * are added for a job in a pending state; however, dependencies
325
325
  * will be added after the job is resumed if relevant.
326
326
  */
327
- expired?: number;
327
+ pending?: number;
328
328
  };
329
329
 
330
330
  /**
package/types/job.ts CHANGED
@@ -108,16 +108,16 @@ type ExtensionType = {
108
108
  marker?: StringStringType;
109
109
 
110
110
  /**
111
- * If provided, the job will initialize in an expired state, reserving
111
+ * If provided, the job will initialize in a pending state, reserving
112
112
  * only the job ID (HSETNX) and persisting search and marker (if provided).
113
113
  * If a `resume` signal is sent before the specified number of seconds,
114
- * the job will resume as normal, transition the the adjacent children
115
- * of the trigger. If the job is not resumed within the
116
- * number of seconds specified, the job will be scrubbed. No dependencies
117
- * are added for a job in an expired state; however, dependencies will be
118
- * added after the job is resumed if relevant.
114
+ * the job will resume as normal, transitioning to the adjacent children
115
+ * of the trigger. If the job is not resumed within the number
116
+ * of seconds specified, the job will be scrubbed. No dependencies
117
+ * are added for a job in a pending state; however, dependencies
118
+ * will be added after the job is resumed if relevant.
119
119
  */
120
- expired?: number;
120
+ pending?: number;
121
121
  };
122
122
 
123
123
  /**