@live-change/task-service 0.8.34 → 0.8.35

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/task.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/task-service",
3
- "version": "0.8.34",
3
+ "version": "0.8.35",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.8.34",
26
- "@live-change/relations-plugin": "^0.8.34"
25
+ "@live-change/framework": "^0.8.35",
26
+ "@live-change/relations-plugin": "^0.8.35"
27
27
  },
28
- "gitHead": "40e61928bf43b35352c76fc135f36a2d8bd76c4a"
28
+ "gitHead": "90fbb746dc7270895daf17b437ca48c0b0a01c01"
29
29
  }
package/task.js CHANGED
@@ -82,6 +82,7 @@ async function startTask(taskFunction, props, causeType, cause){
82
82
  cause,
83
83
  taskObject,
84
84
  }
85
+ console.log("START TASK!", taskFunction.name)
85
86
  const promise = taskFunction(props, context)
86
87
  return { task: taskObject.id, taskObject, promise, causeType, cause }
87
88
  }
@@ -160,6 +161,10 @@ export default function task(definition, serviceDefinition) {
160
161
  task: {
161
162
  id: taskObject.id,
162
163
  async run(taskFunction, props, progressFactor = 1) {
164
+ if(typeof taskFunction !== 'function') {
165
+ console.log("TASK FUNCTION", taskFunction)
166
+ throw new Error('Task function is not a function')
167
+ }
163
168
  //console.log("SUBTASK RUN", taskFunction.definition.name, props)
164
169
  const subtaskProgress = { current: 0, total: 1, factor: progressFactor }
165
170
  subtasksProgress.push(subtaskProgress)