@enonic-types/lib-task 7.16.2 → 8.0.0-A3
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 +2 -2
- package/package.json +2 -2
- package/task.d.ts +2 -42
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default
|
|
|
30
30
|
`example.ts`
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
const {
|
|
33
|
+
const {executeFunction, submitTask, list, get, sleep, progress, isRunning} = require('/lib/xp/task');
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
More detailed explanation on how it works and how to type custom import function can be
|
|
@@ -57,7 +57,7 @@ types mapping to your configuration.
|
|
|
57
57
|
`example.ts`
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
import {
|
|
60
|
+
import {executeFunction, submitTask, list, get, sleep, progress, isRunning} from '/lib/xp/task';
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Setting `baseUrl` and `paths` will allow the `tsc` to keep the valid paths in the resulting JavaScript files.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic-types/lib-task",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-A3",
|
|
4
4
|
"description": "Type definitions for lib-task.",
|
|
5
5
|
"types": "task.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/enonic/xp/tree/master#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@enonic-types/core": "
|
|
30
|
+
"@enonic-types/core": "8.0.0-A3"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
package/task.d.ts
CHANGED
|
@@ -13,11 +13,7 @@ declare global {
|
|
|
13
13
|
}
|
|
14
14
|
import type { UserKey } from '@enonic-types/core';
|
|
15
15
|
export type { ScriptValue, UserKey } from '@enonic-types/core';
|
|
16
|
-
export
|
|
17
|
-
export interface SubmitParams {
|
|
18
|
-
description: string;
|
|
19
|
-
task: CallbackFn;
|
|
20
|
-
}
|
|
16
|
+
export type CallbackFn = () => void;
|
|
21
17
|
export interface ExecuteFunctionParams {
|
|
22
18
|
description: string;
|
|
23
19
|
func: CallbackFn;
|
|
@@ -37,22 +33,6 @@ export interface ExecuteFunctionParams {
|
|
|
37
33
|
* @property {number} progress.total Latest progress target numeric value.
|
|
38
34
|
* @property {string} progress.info Latest progress textual information.
|
|
39
35
|
*/
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated Please use {@link executeFunction}.
|
|
42
|
-
|
|
43
|
-
* Submits a task to be executed in the background and returns an id representing the task.
|
|
44
|
-
*
|
|
45
|
-
* This function returns immediately. The callback function will be executed asynchronously.
|
|
46
|
-
*
|
|
47
|
-
* @example-ref examples/task/submit.js
|
|
48
|
-
*
|
|
49
|
-
* @param {object} params JSON with the parameters.
|
|
50
|
-
* @param {string} params.description Text describing the task to be executed.
|
|
51
|
-
* @param {function} params.task Callback function to be executed asynchronously.
|
|
52
|
-
*
|
|
53
|
-
* @returns {string} Id of the task that will be executed.
|
|
54
|
-
*/
|
|
55
|
-
export declare function submit(params: SubmitParams): string;
|
|
56
36
|
/**
|
|
57
37
|
* Runs a task function in the background and returns an id representing the task.
|
|
58
38
|
*
|
|
@@ -67,26 +47,6 @@ export declare function submit(params: SubmitParams): string;
|
|
|
67
47
|
* @returns {string} Id of the task that will be executed.
|
|
68
48
|
*/
|
|
69
49
|
export declare function executeFunction(params: ExecuteFunctionParams): string;
|
|
70
|
-
export interface SubmitNamedTaskParams<Config extends Record<string, unknown>> {
|
|
71
|
-
name: string;
|
|
72
|
-
config?: Config;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated Please use {@link submitTask}.
|
|
76
|
-
*
|
|
77
|
-
* Submits a named task to be executed in the background and returns an id representing the task.
|
|
78
|
-
*
|
|
79
|
-
* This function returns immediately. The callback function will be executed asynchronously.
|
|
80
|
-
*
|
|
81
|
-
* @example-ref examples/task/submitNamed.js
|
|
82
|
-
*
|
|
83
|
-
* @param {object} params JSON with the parameters.
|
|
84
|
-
* @param {string} params.name Name of the task to execute.
|
|
85
|
-
* @param {object} [params.config] Configuration parameters to pass to the task to be executed.
|
|
86
|
-
* The object must be valid according to the schema defined in the form of the task descriptor XML.
|
|
87
|
-
* @returns {string} Id of the task that will be executed.
|
|
88
|
-
*/
|
|
89
|
-
export declare function submitNamed<Config extends Record<string, unknown> = Record<string, unknown>>(params: SubmitNamedTaskParams<Config>): string;
|
|
90
50
|
export interface SubmitTaskParams<Config extends Record<string, unknown>> {
|
|
91
51
|
descriptor: string;
|
|
92
52
|
name?: string;
|
|
@@ -107,7 +67,7 @@ export interface SubmitTaskParams<Config extends Record<string, unknown>> {
|
|
|
107
67
|
* @returns {string} Id of the task that will be executed.
|
|
108
68
|
*/
|
|
109
69
|
export declare function submitTask<Config extends Record<string, unknown> = Record<string, unknown>>(params: SubmitTaskParams<Config>): string;
|
|
110
|
-
export
|
|
70
|
+
export type TaskStateType = 'WAITING' | 'RUNNING' | 'FINISHED' | 'FAILED';
|
|
111
71
|
export interface ListTasksParams {
|
|
112
72
|
name?: string | null;
|
|
113
73
|
state?: TaskStateType | null;
|