@nocobase/plugin-async-task-manager 2.0.0-alpha.42 → 2.0.0-alpha.44

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.
@@ -8,14 +8,14 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.0-alpha.42",
11
+ "@nocobase/client": "2.0.0-alpha.44",
12
12
  "react": "18.2.0",
13
- "@nocobase/utils": "2.0.0-alpha.42",
13
+ "@nocobase/utils": "2.0.0-alpha.44",
14
14
  "lodash": "4.17.21",
15
- "@nocobase/server": "2.0.0-alpha.42",
16
- "@nocobase/logger": "2.0.0-alpha.42",
17
- "@nocobase/database": "2.0.0-alpha.42",
15
+ "@nocobase/server": "2.0.0-alpha.44",
16
+ "@nocobase/logger": "2.0.0-alpha.44",
17
+ "@nocobase/database": "2.0.0-alpha.44",
18
18
  "antd": "5.24.2",
19
19
  "dayjs": "1.11.13",
20
- "@nocobase/actions": "2.0.0-alpha.42"
20
+ "@nocobase/actions": "2.0.0-alpha.44"
21
21
  };
@@ -0,0 +1,45 @@
1
+ {
2
+ "Actions": "Действия",
3
+ "Cancel": "Отменить",
4
+ "Cancelled": "Отменено",
5
+ "Cancelling": "Отмена",
6
+ "Close": "Закрыть",
7
+ "Completed": "Завершено",
8
+ "Confirm": "Подтвердить",
9
+ "Confirm cancel": "Подтвердить отмену",
10
+ "Confirm cancel description": "Описание подтверждения отмены",
11
+ "Created at": "Создано",
12
+ "Data": "Данные",
13
+ "Download": "Скачать",
14
+ "Error Details": "Детали ошибки",
15
+ "Error code": "Код ошибки",
16
+ "Error details": "Детали ошибки",
17
+ "Export": "Экспорт",
18
+ "Export {collection} attachments": "Экспорт вложений {collection}",
19
+ "Export {collection} data": "Экспорт данных {collection}",
20
+ "Failed": "Не удалось",
21
+ "Import": "Импорт",
22
+ "Import completed": "Импорт завершен",
23
+ "Import details": "Детали импорта",
24
+ "Import result": "Результат импорта",
25
+ "Import summary": "Сводка импорта",
26
+ "Import {collection} data": "Импорт данных {collection}",
27
+ "ImportResult": "Результат импорта",
28
+ "Imported": "Импортировано",
29
+ "OK": "ОК",
30
+ "Processing": "Обработка",
31
+ "Skipped records": "Пропущенные записи",
32
+ "Status": "Статус",
33
+ "Successfully imported": "Успешно импортировано",
34
+ "Task": "Задача",
35
+ "Task cancelled": "Задача отменена",
36
+ "Task completed": "Задача завершена",
37
+ "Task failed": "Задача не выполнена",
38
+ "Task result": "Результат задачи",
39
+ "Total records": "Всего записей",
40
+ "Type": "Тип",
41
+ "Unknown error": "Неизвестная ошибка",
42
+ "Updated records": "Обновленные записи",
43
+ "View result": "Просмотреть результат",
44
+ "Waiting": "Ожидание"
45
+ }
@@ -9,6 +9,7 @@
9
9
  /// <reference types="node" />
10
10
  import { Worker } from 'worker_threads';
11
11
  import { TaskType } from './task-type';
12
+ export declare function parseArgv(list: string[]): any;
12
13
  export declare class CommandTaskType extends TaskType {
13
14
  static type: string;
14
15
  workerThread: Worker;
@@ -36,7 +36,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var command_task_type_exports = {};
38
38
  __export(command_task_type_exports, {
39
- CommandTaskType: () => CommandTaskType
39
+ CommandTaskType: () => CommandTaskType,
40
+ parseArgv: () => parseArgv
40
41
  });
41
42
  module.exports = __toCommonJS(command_task_type_exports);
42
43
  var import_async_task_manager = require("./interfaces/async-task-manager");
@@ -44,6 +45,37 @@ var import_node_process = __toESM(require("node:process"));
44
45
  var import_worker_threads = require("worker_threads");
45
46
  var import_path = __toESM(require("path"));
46
47
  var import_task_type = require("./task-type");
48
+ function parseArgv(list) {
49
+ const argv = {};
50
+ for (const item of list) {
51
+ const match = item.match(/^--([^=]+)=(.*)$/);
52
+ if (match) {
53
+ const key = match[1];
54
+ let value = match[2];
55
+ if (value.startsWith("{") || value.startsWith("[")) {
56
+ try {
57
+ value = JSON.parse(value);
58
+ } catch (err) {
59
+ }
60
+ } else {
61
+ if (value === "true") {
62
+ value = true;
63
+ } else if (value === "false") {
64
+ value = false;
65
+ }
66
+ }
67
+ argv[key] = value;
68
+ continue;
69
+ }
70
+ const parts = item.split(":");
71
+ if (parts.length === 2) {
72
+ const command = parts[0];
73
+ const commandValue = parts[1];
74
+ argv[command] = commandValue;
75
+ }
76
+ }
77
+ return argv;
78
+ }
47
79
  class CommandTaskType extends import_task_type.TaskType {
48
80
  static type = "command";
49
81
  workerThread;
@@ -55,6 +87,7 @@ class CommandTaskType extends import_task_type.TaskType {
55
87
  async execute() {
56
88
  var _a;
57
89
  const { argv } = this.record.params;
90
+ const parsedArgv = parseArgv(argv);
58
91
  const isDev = (((_a = import_node_process.default.argv[1]) == null ? void 0 : _a.endsWith(".ts")) || import_node_process.default.argv[1].includes("tinypool")) ?? false;
59
92
  const appRoot = import_node_process.default.env.APP_PACKAGE_ROOT || "packages/core/app";
60
93
  const workerPath = import_path.default.resolve(import_node_process.default.cwd(), appRoot, isDev ? "src/index.ts" : "lib/index.js");
@@ -73,7 +106,8 @@ class CommandTaskType extends import_task_type.TaskType {
73
106
  },
74
107
  env: {
75
108
  ...import_node_process.default.env,
76
- WORKER_MODE: "-"
109
+ WORKER_MODE: "-",
110
+ ...parsedArgv.app && parsedArgv.app !== "main" ? { STARTUP_SUBAPP: parsedArgv.app } : {}
77
111
  }
78
112
  });
79
113
  this.workerThread = worker;
@@ -128,5 +162,6 @@ class CommandTaskType extends import_task_type.TaskType {
128
162
  }
129
163
  // Annotate the CommonJS export names for ESM import in node:
130
164
  0 && (module.exports = {
131
- CommandTaskType
165
+ CommandTaskType,
166
+ parseArgv
132
167
  });
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-async-task-manager",
3
3
  "displayName": "Async task manager",
4
+ "displayName.ru-RU": "Менеджер асинхронных задач",
4
5
  "displayName.zh-CN": "异步任务管理器",
5
6
  "description": "Manage and monitor asynchronous tasks such as data import/export. Support task progress tracking and notification.",
7
+ "description.ru-RU": "Управление асинхронными задачами и мониторинг (например, импорт/экспорт данных). Поддержка отслеживания прогресса и уведомлений о задачах.",
6
8
  "description.zh-CN": "管理和监控数据导入导出等异步任务。支持任务进度跟踪和通知。",
7
- "version": "2.0.0-alpha.42",
9
+ "version": "2.0.0-alpha.44",
8
10
  "main": "dist/server/index.js",
9
11
  "peerDependencies": {
10
12
  "@nocobase/client": "2.x",
@@ -15,5 +17,5 @@
15
17
  "dependencies": {
16
18
  "p-queue": "^6.6.2"
17
19
  },
18
- "gitHead": "9e96dd78d0c1445c8da76863e30f046be5b48d90"
20
+ "gitHead": "075bd484c270740fe9b02f1989818da91139b6b9"
19
21
  }