@twin.org/background-task-models 0.0.1-next.3 → 0.0.1-next.4

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,5 +1,4 @@
1
1
  export * from "./factories/backgroundTaskConnectorFactory";
2
- export * from "./models/backgroundTaskHandler";
3
2
  export * from "./models/IBackgroundTask";
4
3
  export * from "./models/IBackgroundTaskConnector";
5
4
  export * from "./models/taskStatus";
@@ -1,6 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
2
  import type { SortDirection } from "@twin.org/entity";
3
- import type { BackgroundTaskHandler } from "./backgroundTaskHandler";
4
3
  import type { IBackgroundTask } from "./IBackgroundTask";
5
4
  import type { TaskStatus } from "./taskStatus";
6
5
  /**
@@ -10,10 +9,11 @@ export interface IBackgroundTaskConnector extends IComponent {
10
9
  /**
11
10
  * Register a handler for a task.
12
11
  * @param taskType The type of the task the handler can process.
13
- * @param handler The handler for the task.
12
+ * @param module The module the handler is in.
13
+ * @param method The method in the module to execute.
14
14
  * @returns Nothing.
15
15
  */
16
- registerHandler<T, U>(taskType: string, handler: BackgroundTaskHandler<T, U>): Promise<void>;
16
+ registerHandler(taskType: string, module: string, method: string): Promise<void>;
17
17
  /**
18
18
  * Unregister a handler for a task.
19
19
  * @param taskType The type of the task handler to remove.
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/background-task-models - Changelog
2
2
 
3
- ## v0.0.1-next.3
3
+ ## v0.0.1-next.4
4
4
 
5
5
  - Initial Release
@@ -7,7 +7,6 @@
7
7
 
8
8
  ## Type Aliases
9
9
 
10
- - [BackgroundTaskHandler](type-aliases/BackgroundTaskHandler.md)
11
10
  - [TaskStatus](type-aliases/TaskStatus.md)
12
11
 
13
12
  ## Variables
@@ -10,25 +10,23 @@ Interface describing a background task connector.
10
10
 
11
11
  ### registerHandler()
12
12
 
13
- > **registerHandler**\<`T`, `U`\>(`taskType`, `handler`): `Promise`\<`void`\>
13
+ > **registerHandler**(`taskType`, `module`, `method`): `Promise`\<`void`\>
14
14
 
15
15
  Register a handler for a task.
16
16
 
17
- #### Type Parameters
18
-
19
- • **T**
20
-
21
- • **U**
22
-
23
17
  #### Parameters
24
18
 
25
19
  • **taskType**: `string`
26
20
 
27
21
  The type of the task the handler can process.
28
22
 
29
- • **handler**: [`BackgroundTaskHandler`](../type-aliases/BackgroundTaskHandler.md)\<`T`, `U`\>
23
+ • **module**: `string`
24
+
25
+ The module the handler is in.
26
+
27
+ • **method**: `string`
30
28
 
31
- The handler for the task.
29
+ The method in the module to execute.
32
30
 
33
31
  #### Returns
34
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/background-task-models",
3
- "version": "0.0.1-next.3",
3
+ "version": "0.0.1-next.4",
4
4
  "description": "Models which define the structure of the background task contracts and connectors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +0,0 @@
1
- /**
2
- * Interface describing a task handler, exceptions thrown in the handler will be caught.
3
- */
4
- export type BackgroundTaskHandler<T = any, U = any> = (payload: T) => Promise<U>;
@@ -1,19 +0,0 @@
1
- # Type Alias: BackgroundTaskHandler()\<T, U\>
2
-
3
- > **BackgroundTaskHandler**\<`T`, `U`\>: (`payload`) => `Promise`\<`U`\>
4
-
5
- Interface describing a task handler, exceptions thrown in the handler will be caught.
6
-
7
- ## Type Parameters
8
-
9
- • **T** = `any`
10
-
11
- • **U** = `any`
12
-
13
- ## Parameters
14
-
15
- • **payload**: `T`
16
-
17
- ## Returns
18
-
19
- `Promise`\<`U`\>