@live-change/task-service 0.9.166 → 0.9.169

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.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/task-service",
3
- "version": "0.9.166",
3
+ "version": "0.9.169",
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.9.166",
26
- "@live-change/relations-plugin": "^0.9.166"
25
+ "@live-change/framework": "^0.9.169",
26
+ "@live-change/relations-plugin": "^0.9.169"
27
27
  },
28
- "gitHead": "e99ff5ce503d5dc894d0cfe954a58397683d12e0"
28
+ "gitHead": "6801ab3c35069e825eaef646ede6c6cfaf566bcf"
29
29
  }
package/task.ts CHANGED
@@ -36,7 +36,7 @@ async function triggerOnTaskStateChange(taskObject, causeType, cause) {
36
36
  })
37
37
  }
38
38
 
39
- interface ClientInfo {
39
+ export interface ClientInfo {
40
40
  user?: string
41
41
  session?: string
42
42
  }
@@ -119,7 +119,7 @@ interface TaskExecuteContext {
119
119
  cause: string
120
120
  }
121
121
 
122
- interface TaskDefinition {
122
+ export interface TaskDefinition {
123
123
  /**
124
124
  * Task name
125
125
  */
@@ -235,6 +235,8 @@ export default function task(definition:TaskDefinition, serviceDefinition) {
235
235
  if(!definition) throw new Error('Task definition is not defined')
236
236
  if(!serviceDefinition) throw new Error('Service definition is not defined')
237
237
  definition.service = serviceDefinition.name
238
+ if(!definition.properties) throw new Error('Task properties are not defined in ' + definition.name)
239
+
238
240
  const taskFunction = async (props, context,
239
241
  emit = events => app.emitEvents(definition.name, Array.isArray(events) ? events : [events], {}),
240
242
  reportProgress = (current, total, selfProgress) => {}) => {
@@ -590,7 +592,7 @@ export default function task(definition:TaskDefinition, serviceDefinition) {
590
592
  return startResult.task
591
593
  }
592
594
  })
593
- } else {
595
+ } else {
594
596
  serviceDefinition.trigger({
595
597
  name: 'runTask_'+serviceDefinition.name+'_'+definition.name,
596
598
  properties: definition.properties,