@webiny/api-headless-cms-bulk-actions 5.41.0-beta.0 → 5.41.0-beta.2
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/package.json +18 -18
- package/tasks/createEmptyTrashBinsTask.js +75 -28
- package/tasks/createEmptyTrashBinsTask.js.map +1 -1
- package/types.d.ts +5 -1
- package/types.js +3 -0
- package/types.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-bulk-actions",
|
|
3
|
-
"version": "5.41.0-beta.
|
|
3
|
+
"version": "5.41.0-beta.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Webiny Headless CMS bulk actions",
|
|
6
6
|
"keywords": [
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@webiny/api-headless-cms": "5.41.0-beta.
|
|
17
|
-
"@webiny/handler": "5.41.0-beta.
|
|
18
|
-
"@webiny/handler-aws": "5.41.0-beta.
|
|
19
|
-
"@webiny/tasks": "5.41.0-beta.
|
|
20
|
-
"@webiny/utils": "5.41.0-beta.
|
|
16
|
+
"@webiny/api-headless-cms": "5.41.0-beta.2",
|
|
17
|
+
"@webiny/handler": "5.41.0-beta.2",
|
|
18
|
+
"@webiny/handler-aws": "5.41.0-beta.2",
|
|
19
|
+
"@webiny/tasks": "5.41.0-beta.2",
|
|
20
|
+
"@webiny/utils": "5.41.0-beta.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/cli": "7.24.1",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@babel/preset-env": "7.24.3",
|
|
26
26
|
"@babel/preset-typescript": "7.24.1",
|
|
27
27
|
"@babel/runtime": "7.24.1",
|
|
28
|
-
"@webiny/api": "5.41.0-beta.
|
|
29
|
-
"@webiny/api-admin-users": "5.41.0-beta.
|
|
30
|
-
"@webiny/api-i18n": "5.41.0-beta.
|
|
31
|
-
"@webiny/api-security": "5.41.0-beta.
|
|
32
|
-
"@webiny/api-tenancy": "5.41.0-beta.
|
|
33
|
-
"@webiny/api-wcp": "5.41.0-beta.
|
|
34
|
-
"@webiny/cli": "5.41.0-beta.
|
|
35
|
-
"@webiny/handler-graphql": "5.41.0-beta.
|
|
36
|
-
"@webiny/plugins": "5.41.0-beta.
|
|
37
|
-
"@webiny/project-utils": "5.41.0-beta.
|
|
38
|
-
"@webiny/wcp": "5.41.0-beta.
|
|
28
|
+
"@webiny/api": "5.41.0-beta.2",
|
|
29
|
+
"@webiny/api-admin-users": "5.41.0-beta.2",
|
|
30
|
+
"@webiny/api-i18n": "5.41.0-beta.2",
|
|
31
|
+
"@webiny/api-security": "5.41.0-beta.2",
|
|
32
|
+
"@webiny/api-tenancy": "5.41.0-beta.2",
|
|
33
|
+
"@webiny/api-wcp": "5.41.0-beta.2",
|
|
34
|
+
"@webiny/cli": "5.41.0-beta.2",
|
|
35
|
+
"@webiny/handler-graphql": "5.41.0-beta.2",
|
|
36
|
+
"@webiny/plugins": "5.41.0-beta.2",
|
|
37
|
+
"@webiny/project-utils": "5.41.0-beta.2",
|
|
38
|
+
"@webiny/wcp": "5.41.0-beta.2",
|
|
39
39
|
"graphql": "15.8.0",
|
|
40
40
|
"ttypescript": "1.5.15",
|
|
41
41
|
"typescript": "4.9.5"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public",
|
|
49
49
|
"directory": "dist"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "391a78231f6c46fddf9f6a5bfd2ee95f1cb18eb9"
|
|
52
52
|
}
|
|
@@ -19,33 +19,90 @@ const calculateDateTimeString = () => {
|
|
|
19
19
|
// Return the calculated date-time string in ISO 8601 format.
|
|
20
20
|
return currentDate.toISOString();
|
|
21
21
|
};
|
|
22
|
+
const cleanup = async ({
|
|
23
|
+
context,
|
|
24
|
+
task
|
|
25
|
+
}) => {
|
|
26
|
+
// We want to clean all child tasks and logs, which have no errors.
|
|
27
|
+
const childTasksCleanup = new _internals.ChildTasksCleanup();
|
|
28
|
+
try {
|
|
29
|
+
await childTasksCleanup.execute({
|
|
30
|
+
context,
|
|
31
|
+
task
|
|
32
|
+
});
|
|
33
|
+
} catch (ex) {
|
|
34
|
+
console.error(`Error while cleaning "EmptyTrashBins" child tasks.`, ex);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
22
37
|
const createEmptyTrashBinsTask = () => {
|
|
23
|
-
return (0, _tasks.
|
|
24
|
-
isPrivate: true,
|
|
38
|
+
return (0, _tasks.createPrivateTaskDefinition)({
|
|
25
39
|
id: "hcmsEntriesEmptyTrashBins",
|
|
26
40
|
title: "Headless CMS - Empty all trash bins",
|
|
27
41
|
description: "Delete all entries found in the trash bin, for each model found in the system.",
|
|
28
|
-
maxIterations:
|
|
42
|
+
maxIterations: 24,
|
|
43
|
+
disableDatabaseLogs: true,
|
|
29
44
|
run: async params => {
|
|
30
45
|
const {
|
|
31
46
|
response,
|
|
32
47
|
isAborted,
|
|
33
|
-
|
|
48
|
+
isCloseToTimeout,
|
|
49
|
+
context,
|
|
50
|
+
trigger,
|
|
51
|
+
input,
|
|
52
|
+
store
|
|
34
53
|
} = params;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
if (isAborted()) {
|
|
55
|
+
return response.aborted();
|
|
56
|
+
} else if (isCloseToTimeout()) {
|
|
57
|
+
return response.continue({
|
|
58
|
+
...input
|
|
59
|
+
}, {
|
|
60
|
+
seconds: 30
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (input.triggered) {
|
|
64
|
+
const {
|
|
65
|
+
items
|
|
66
|
+
} = await context.tasks.listTasks({
|
|
67
|
+
where: {
|
|
68
|
+
parentId: store.getTask().id,
|
|
69
|
+
taskStatus_in: [_tasks.TaskDataStatus.RUNNING, _tasks.TaskDataStatus.PENDING]
|
|
70
|
+
},
|
|
71
|
+
limit: 100000
|
|
72
|
+
});
|
|
73
|
+
if (items.length === 0) {
|
|
74
|
+
return response.done("Task done: emptying the trash bin for all registered models.");
|
|
75
|
+
}
|
|
76
|
+
for (const item of items) {
|
|
77
|
+
const status = await context.tasks.fetchServiceInfo(item.id);
|
|
78
|
+
if (status?.status === "FAILED" || status?.status === "TIMED_OUT") {
|
|
79
|
+
await context.tasks.updateTask(item.id, {
|
|
80
|
+
taskStatus: _tasks.TaskDataStatus.FAILED
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (status?.status === "ABORTED") {
|
|
85
|
+
await context.tasks.updateTask(item.id, {
|
|
86
|
+
taskStatus: _tasks.TaskDataStatus.ABORTED
|
|
87
|
+
});
|
|
88
|
+
}
|
|
38
89
|
}
|
|
90
|
+
return response.continue({
|
|
91
|
+
...input
|
|
92
|
+
}, {
|
|
93
|
+
seconds: 3600
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
39
97
|
const locales = context.i18n.getLocales();
|
|
40
98
|
await context.i18n.withEachLocale(locales, async () => {
|
|
41
99
|
const models = await context.security.withoutAuthorization(async () => {
|
|
42
100
|
return (await context.cms.listModels()).filter(model => !model.isPrivate);
|
|
43
101
|
});
|
|
44
102
|
for (const model of models) {
|
|
45
|
-
await
|
|
103
|
+
await trigger({
|
|
46
104
|
name: `Headless CMS - Empty trash bin for "${model.name}" model.`,
|
|
47
105
|
definition: "hcmsBulkListDeleteEntries",
|
|
48
|
-
parent: params.store.getTask(),
|
|
49
106
|
input: {
|
|
50
107
|
modelId: model.modelId,
|
|
51
108
|
where: {
|
|
@@ -54,30 +111,20 @@ const createEmptyTrashBinsTask = () => {
|
|
|
54
111
|
}
|
|
55
112
|
});
|
|
56
113
|
}
|
|
57
|
-
return;
|
|
58
114
|
});
|
|
59
|
-
return response.
|
|
115
|
+
return response.continue({
|
|
116
|
+
triggered: true
|
|
117
|
+
}, {
|
|
118
|
+
seconds: 120
|
|
119
|
+
});
|
|
60
120
|
} catch (ex) {
|
|
61
121
|
return response.error(ex.message ?? "Error while executing EmptyTrashBins task");
|
|
62
122
|
}
|
|
63
123
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* We want to clean all child tasks and logs, which have no errors.
|
|
70
|
-
*/
|
|
71
|
-
const childTasksCleanup = new _internals.ChildTasksCleanup();
|
|
72
|
-
try {
|
|
73
|
-
await childTasksCleanup.execute({
|
|
74
|
-
context,
|
|
75
|
-
task
|
|
76
|
-
});
|
|
77
|
-
} catch (ex) {
|
|
78
|
-
console.error("Error while cleaning `EmptyTrashBins` child tasks.", ex);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
124
|
+
onMaxIterations: cleanup,
|
|
125
|
+
onDone: cleanup,
|
|
126
|
+
onError: cleanup,
|
|
127
|
+
onAbort: cleanup
|
|
81
128
|
});
|
|
82
129
|
};
|
|
83
130
|
exports.createEmptyTrashBinsTask = createEmptyTrashBinsTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_tasks","require","_internals","calculateDateTimeString","retentionPeriodFromEnv","process","env","retentionPeriod","Number","currentDate","Date","setDate","getDate","toISOString","
|
|
1
|
+
{"version":3,"names":["_tasks","require","_internals","calculateDateTimeString","retentionPeriodFromEnv","process","env","retentionPeriod","Number","currentDate","Date","setDate","getDate","toISOString","cleanup","context","task","childTasksCleanup","ChildTasksCleanup","execute","ex","console","error","createEmptyTrashBinsTask","createPrivateTaskDefinition","id","title","description","maxIterations","disableDatabaseLogs","run","params","response","isAborted","isCloseToTimeout","trigger","input","store","aborted","continue","seconds","triggered","items","tasks","listTasks","where","parentId","getTask","taskStatus_in","TaskDataStatus","RUNNING","PENDING","limit","length","done","item","status","fetchServiceInfo","updateTask","taskStatus","FAILED","ABORTED","locales","i18n","getLocales","withEachLocale","models","security","withoutAuthorization","cms","listModels","filter","model","isPrivate","name","definition","modelId","deletedOn_lt","message","onMaxIterations","onDone","onError","onAbort","exports"],"sources":["createEmptyTrashBinsTask.ts"],"sourcesContent":["import { createPrivateTaskDefinition, TaskDataStatus } from \"@webiny/tasks\";\nimport {\n HcmsBulkActionsContext,\n IBulkActionOperationByModelInput,\n TrashBinCleanUpParams\n} from \"~/types\";\nimport { ChildTasksCleanup } from \"~/useCases/internals\";\n\nconst calculateDateTimeString = () => {\n // Retrieve the retention period from the environment variable WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS,\n // or default to 90 days if not set or set to 0.\n const retentionPeriodFromEnv = process.env[\"WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS\"];\n const retentionPeriod =\n retentionPeriodFromEnv && Number(retentionPeriodFromEnv) !== 0\n ? Number(retentionPeriodFromEnv)\n : 90;\n\n // Calculate the date-time by subtracting the retention period (in days) from the current date.\n const currentDate = new Date();\n currentDate.setDate(currentDate.getDate() - retentionPeriod);\n\n // Return the calculated date-time string in ISO 8601 format.\n return currentDate.toISOString();\n};\n\nconst cleanup = async ({ context, task }: TrashBinCleanUpParams) => {\n // We want to clean all child tasks and logs, which have no errors.\n const childTasksCleanup = new ChildTasksCleanup();\n try {\n await childTasksCleanup.execute({\n context,\n task\n });\n } catch (ex) {\n console.error(`Error while cleaning \"EmptyTrashBins\" child tasks.`, ex);\n }\n};\n\nexport const createEmptyTrashBinsTask = () => {\n return createPrivateTaskDefinition<HcmsBulkActionsContext>({\n id: \"hcmsEntriesEmptyTrashBins\",\n title: \"Headless CMS - Empty all trash bins\",\n description:\n \"Delete all entries found in the trash bin, for each model found in the system.\",\n maxIterations: 24,\n disableDatabaseLogs: true,\n run: async params => {\n const { response, isAborted, isCloseToTimeout, context, trigger, input, store } =\n params;\n if (isAborted()) {\n return response.aborted();\n } else if (isCloseToTimeout()) {\n return response.continue(\n {\n ...input\n },\n {\n seconds: 30\n }\n );\n }\n\n if (input.triggered) {\n const { items } = await context.tasks.listTasks({\n where: {\n parentId: store.getTask().id,\n taskStatus_in: [TaskDataStatus.RUNNING, TaskDataStatus.PENDING]\n },\n limit: 100000\n });\n\n if (items.length === 0) {\n return response.done(\n \"Task done: emptying the trash bin for all registered models.\"\n );\n }\n\n for (const item of items) {\n const status = await context.tasks.fetchServiceInfo(item.id);\n\n if (status?.status === \"FAILED\" || status?.status === \"TIMED_OUT\") {\n await context.tasks.updateTask(item.id, {\n taskStatus: TaskDataStatus.FAILED\n });\n continue;\n }\n\n if (status?.status === \"ABORTED\") {\n await context.tasks.updateTask(item.id, {\n taskStatus: TaskDataStatus.ABORTED\n });\n }\n }\n\n return response.continue(\n {\n ...input\n },\n {\n seconds: 3600\n }\n );\n }\n\n try {\n const locales = context.i18n.getLocales();\n\n await context.i18n.withEachLocale(locales, async () => {\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter(model => !model.isPrivate);\n });\n\n for (const model of models) {\n await trigger<IBulkActionOperationByModelInput>({\n name: `Headless CMS - Empty trash bin for \"${model.name}\" model.`,\n definition: \"hcmsBulkListDeleteEntries\",\n input: {\n modelId: model.modelId,\n where: {\n deletedOn_lt: calculateDateTimeString()\n }\n }\n });\n }\n });\n\n return response.continue(\n {\n triggered: true\n },\n {\n seconds: 120\n }\n );\n } catch (ex) {\n return response.error(ex.message ?? \"Error while executing EmptyTrashBins task\");\n }\n },\n onMaxIterations: cleanup,\n onDone: cleanup,\n onError: cleanup,\n onAbort: cleanup\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AAEA,MAAME,uBAAuB,GAAGA,CAAA,KAAM;EAClC;EACA;EACA,MAAMC,sBAAsB,GAAGC,OAAO,CAACC,GAAG,CAAC,wCAAwC,CAAC;EACpF,MAAMC,eAAe,GACjBH,sBAAsB,IAAII,MAAM,CAACJ,sBAAsB,CAAC,KAAK,CAAC,GACxDI,MAAM,CAACJ,sBAAsB,C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D,MAAMI,MAAM,GAAG,MAAMnD,OAAO,CAACoD,QAAQ,CAACC,oBAAoB,CAAC,YAAY;YACnE,OAAO,CAAC,MAAMrD,OAAO,CAACsD,GAAG,CAACC,UAAU,CAAC,CAAC,EAAEC,MAAM,CAACC,KAAK,IAAI,CAACA,KAAK,CAACC,SAAS,CAAC;UAC7E,CAAC,CAAC;UAEF,KAAK,MAAMD,KAAK,IAAIN,MAAM,EAAE;YACxB,MAAM/B,OAAO,CAAmC;cAC5CuC,IAAI,EAAG,uCAAsCF,KAAK,CAACE,IAAK,UAAS;cACjEC,UAAU,EAAE,2BAA2B;cACvCvC,KAAK,EAAE;gBACHwC,OAAO,EAAEJ,KAAK,CAACI,OAAO;gBACtB/B,KAAK,EAAE;kBACHgC,YAAY,EAAE1E,uBAAuB,CAAC;gBAC1C;cACJ;YACJ,CAAC,CAAC;UACN;QACJ,CAAC,CAAC;QAEF,OAAO6B,QAAQ,CAACO,QAAQ,CACpB;UACIE,SAAS,EAAE;QACf,CAAC,EACD;UACID,OAAO,EAAE;QACb,CACJ,CAAC;MACL,CAAC,CAAC,OAAOpB,EAAE,EAAE;QACT,OAAOY,QAAQ,CAACV,KAAK,CAACF,EAAE,CAAC0D,OAAO,IAAI,2CAA2C,CAAC;MACpF;IACJ,CAAC;IACDC,eAAe,EAAEjE,OAAO;IACxBkE,MAAM,EAAElE,OAAO;IACfmE,OAAO,EAAEnE,OAAO;IAChBoE,OAAO,EAAEpE;EACb,CAAC,CAAC;AACN,CAAC;AAACqE,OAAA,CAAA5D,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CmsContext } from "@webiny/api-headless-cms/types";
|
|
2
2
|
import { Context as BaseContext } from "@webiny/handler/types";
|
|
3
|
-
import { Context as TasksContext, ITaskResponseDoneResultOutput, ITaskRunParams } from "@webiny/tasks/types";
|
|
3
|
+
import { Context as TasksContext, ITaskOnAbortParams, ITaskOnErrorParams, ITaskOnMaxIterationsParams, ITaskOnSuccessParams, ITaskResponseDoneResultOutput, ITaskRunParams } from "@webiny/tasks/types";
|
|
4
4
|
import { SecurityIdentity } from "@webiny/api-security/types";
|
|
5
5
|
export interface HcmsBulkActionsContext extends BaseContext, CmsContext, TasksContext {
|
|
6
6
|
}
|
|
@@ -43,3 +43,7 @@ export interface IBulkActionOperationByModelOutput extends ITaskResponseDoneResu
|
|
|
43
43
|
failed: string[];
|
|
44
44
|
}
|
|
45
45
|
export type IBulkActionOperationByModelTaskParams = ITaskRunParams<HcmsBulkActionsContext, IBulkActionOperationByModelInput, IBulkActionOperationByModelOutput>;
|
|
46
|
+
/**
|
|
47
|
+
* Trash Bin
|
|
48
|
+
*/
|
|
49
|
+
export type TrashBinCleanUpParams = ITaskOnSuccessParams<HcmsBulkActionsContext> | ITaskOnErrorParams<HcmsBulkActionsContext> | ITaskOnAbortParams<HcmsBulkActionsContext> | ITaskOnMaxIterationsParams<HcmsBulkActionsContext>;
|
package/types.js
CHANGED
|
@@ -17,5 +17,8 @@ let BulkActionOperationByModelAction = exports.BulkActionOperationByModelAction
|
|
|
17
17
|
BulkActionOperationByModelAction["END_TASK"] = "END_TASK";
|
|
18
18
|
return BulkActionOperationByModelAction;
|
|
19
19
|
}({});
|
|
20
|
+
/**
|
|
21
|
+
* Trash Bin
|
|
22
|
+
*/
|
|
20
23
|
|
|
21
24
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BulkActionOperationByModelAction","exports"],"sources":["types.ts"],"sourcesContent":["import { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport {\n Context as TasksContext,\n ITaskResponseDoneResultOutput,\n ITaskRunParams\n} from \"@webiny/tasks/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport interface HcmsBulkActionsContext extends BaseContext, CmsContext, TasksContext {}\n\n/**\n * Bulk Action Operation\n */\n\nexport interface IBulkActionOperationInput {\n modelId: string;\n ids: string[];\n data?: Record<string, any>;\n identity: SecurityIdentity;\n done?: string[];\n failed?: string[];\n}\n\nexport interface IBulkActionOperationOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationInput,\n IBulkActionOperationOutput\n>;\n\n/**\n * Bulk Action Operation By Model\n */\n\nexport enum BulkActionOperationByModelAction {\n CREATE_SUBTASKS = \"CREATE_SUBTASKS\",\n CHECK_MORE_SUBTASKS = \"CHECK_MORE_SUBTASKS\",\n PROCESS_SUBTASKS = \"PROCESS_SUBTASKS\",\n END_TASK = \"END_TASK\"\n}\n\nexport interface IBulkActionOperationByModelInput {\n modelId: string;\n identity?: SecurityIdentity;\n where?: Record<string, any>;\n search?: string;\n after?: string | null;\n data?: Record<string, any>;\n action?: BulkActionOperationByModelAction;\n}\n\nexport interface IBulkActionOperationByModelOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationByModelTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationByModelInput,\n IBulkActionOperationByModelOutput\n>;\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["BulkActionOperationByModelAction","exports"],"sources":["types.ts"],"sourcesContent":["import { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { Context as BaseContext } from \"@webiny/handler/types\";\nimport {\n Context as TasksContext,\n ITaskOnAbortParams,\n ITaskOnErrorParams,\n ITaskOnMaxIterationsParams,\n ITaskOnSuccessParams,\n ITaskResponseDoneResultOutput,\n ITaskRunParams\n} from \"@webiny/tasks/types\";\nimport { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport interface HcmsBulkActionsContext extends BaseContext, CmsContext, TasksContext {}\n\n/**\n * Bulk Action Operation\n */\n\nexport interface IBulkActionOperationInput {\n modelId: string;\n ids: string[];\n data?: Record<string, any>;\n identity: SecurityIdentity;\n done?: string[];\n failed?: string[];\n}\n\nexport interface IBulkActionOperationOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationInput,\n IBulkActionOperationOutput\n>;\n\n/**\n * Bulk Action Operation By Model\n */\n\nexport enum BulkActionOperationByModelAction {\n CREATE_SUBTASKS = \"CREATE_SUBTASKS\",\n CHECK_MORE_SUBTASKS = \"CHECK_MORE_SUBTASKS\",\n PROCESS_SUBTASKS = \"PROCESS_SUBTASKS\",\n END_TASK = \"END_TASK\"\n}\n\nexport interface IBulkActionOperationByModelInput {\n modelId: string;\n identity?: SecurityIdentity;\n where?: Record<string, any>;\n search?: string;\n after?: string | null;\n data?: Record<string, any>;\n action?: BulkActionOperationByModelAction;\n}\n\nexport interface IBulkActionOperationByModelOutput extends ITaskResponseDoneResultOutput {\n done: string[];\n failed: string[];\n}\n\nexport type IBulkActionOperationByModelTaskParams = ITaskRunParams<\n HcmsBulkActionsContext,\n IBulkActionOperationByModelInput,\n IBulkActionOperationByModelOutput\n>;\n\n/**\n * Trash Bin\n */\n\nexport type TrashBinCleanUpParams =\n | ITaskOnSuccessParams<HcmsBulkActionsContext>\n | ITaskOnErrorParams<HcmsBulkActionsContext>\n | ITaskOnAbortParams<HcmsBulkActionsContext>\n | ITaskOnMaxIterationsParams<HcmsBulkActionsContext>;\n"],"mappings":";;;;;;AAeA;AACA;AACA;AAsBA;AACA;AACA;AAFA,IAIYA,gCAAgC,GAAAC,OAAA,CAAAD,gCAAA,0BAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAA,OAAhCA,gCAAgC;AAAA;AA4B5C;AACA;AACA","ignoreList":[]}
|