@chevre/domain 24.0.0-alpha.75 → 24.0.0-alpha.76

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,6 +1,11 @@
1
1
  import type { INextFunction } from '../eventEmitter/task';
2
2
  import { factory } from '../factory';
3
- import type { ICallResult, ICallableTaskOperation, IExecutableTask, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
3
+ import type { ICallResult, ICallableTaskOperation, ICallableTaskOperationSimple, IExecutableTask, IExecutableTaskKeys, IOperationExecute } from '../taskSettings';
4
+ export declare const taskLoader: {
5
+ load: (taskName: string) => Promise<{
6
+ call: ICallableTaskOperationSimple | ICallableTaskOperation;
7
+ }>;
8
+ };
4
9
  /**
5
10
  * タスクを実行する
6
11
  */
@@ -3,12 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.taskLoader = void 0;
6
7
  exports.executeTask = executeTask;
7
8
  const debug_1 = __importDefault(require("debug"));
8
9
  const moment_1 = __importDefault(require("moment"));
9
10
  const factory_1 = require("../factory");
10
11
  const onOperationFailed_1 = require("./taskHandler/onOperationFailed");
11
12
  const debug = (0, debug_1.default)('chevre-domain:service:taskHandler');
13
+ exports.taskLoader = {
14
+ load: (taskName) => {
15
+ return import(`./task/${taskName}.js`);
16
+ }
17
+ };
12
18
  /**
13
19
  * タスクを実行する
14
20
  */
@@ -36,7 +42,10 @@ function executeTask(task, next) {
36
42
  }
37
43
  // タスク名の関数が定義されていなければ、TypeErrorとなる
38
44
  let callResult;
39
- const { call } = await import(`./task/${task.name}`);
45
+ // const { call } = await import(`./task/${task.name}.js`) as {
46
+ // call: ICallableTaskOperationSimple | ICallableTaskOperation;
47
+ // };
48
+ const { call } = await exports.taskLoader.load(task.name); // testが書きづらいのでtaskLoader経由で呼ぶ
40
49
  switch (task.name) {
41
50
  case factory_1.factory.taskName.AcceptCOAOffer:
42
51
  case factory_1.factory.taskName.AggregateOnSystem:
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.0.0-alpha.75"
94
+ "version": "24.0.0-alpha.76"
95
95
  }