@chevre/domain 26.0.0-alpha.17 → 26.0.0-alpha.19

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.
@@ -29,7 +29,7 @@ export declare class TaskDelayedRepo {
29
29
  /**
30
30
  * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更した上で、Runningイベントを発生させる
31
31
  */
32
- emitRunningIfExistsByName(params: {
32
+ runDelayedTaskIfExistsByName(params: {
33
33
  /**
34
34
  * 必ずタスク名指定で実行する
35
35
  */
@@ -53,10 +53,9 @@ export declare class TaskDelayedRepo {
53
53
  }): Promise<Pick<factory.task.ITask<factory.taskName>, 'id' | 'name'> | null>;
54
54
  /**
55
55
  * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更した上で、Runningイベントを発生させる
56
- * taskNameで絞らない
57
- * 2026-08-04~
56
+ * 2026-08-06~
58
57
  */
59
- emitRunningIfExistsNoName(params: {
58
+ runDelayedTaskIfExists(params: {
60
59
  runsAt: {
61
60
  $lt: Date;
62
61
  };
@@ -80,7 +79,7 @@ export declare class TaskDelayedRepo {
80
79
  };
81
80
  }): Promise<UpdateWriteOpResult>;
82
81
  /**
83
- * $lte:0をReadyにする(特定のタスクを除いて) -> Readyにすれば自動的にAbortedになる
82
+ * $lte:0をReadyにする -> Readyにすれば自動的にAbortedになる
84
83
  */
85
84
  retryAbortingTasks(params: {
86
85
  intervalInMinutes: number;
@@ -81,11 +81,11 @@ class TaskDelayedRepo {
81
81
  /**
82
82
  * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更した上で、Runningイベントを発生させる
83
83
  */
84
- async emitRunningIfExistsByName(params) {
84
+ async runDelayedTaskIfExistsByName(params) {
85
85
  if (!(params.runsAt.$lt instanceof Date)) {
86
86
  throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
87
87
  }
88
- // インデックス'executeOneByNameIfExists'を想定したfilter
88
+ // インデックスについては、name指定であれば'executeOneByName'あるいは'runDelayedTaskByName'を想定
89
89
  const filter = {
90
90
  status: { $eq: factory_1.factory.taskStatus.Ready },
91
91
  name: params.name,
@@ -119,14 +119,13 @@ class TaskDelayedRepo {
119
119
  }
120
120
  /**
121
121
  * 実行日時を一定期間過ぎたReadyタスクについて、Runningステータスに変更した上で、Runningイベントを発生させる
122
- * taskNameで絞らない
123
- * 2026-08-04~
122
+ * 2026-08-06~
124
123
  */
125
- async emitRunningIfExistsNoName(params) {
124
+ async runDelayedTaskIfExists(params) {
126
125
  if (!(params.runsAt.$lt instanceof Date)) {
127
126
  throw new factory_1.factory.errors.Argument('runsAt.$lt', 'must be Date');
128
127
  }
129
- // インデックス'executeOneByNameIfExists'を想定したfilter
128
+ // インデックスについては、name未指定であれば'executeOneByNameIfExists'を想定
130
129
  const filter = {
131
130
  status: { $eq: factory_1.factory.taskStatus.Ready },
132
131
  runsAt: { $lt: params.runsAt.$lt }
@@ -160,11 +159,11 @@ class TaskDelayedRepo {
160
159
  // @see schemas/task
161
160
  {
162
161
  status: { $eq: factory_1.factory.taskStatus.Running },
162
+ remainingNumberOfTries: { $gte: 1 },
163
163
  lastTriedAt: {
164
164
  $type: 'date',
165
165
  $lt: lastTriedAtShoudBeLessThan
166
- },
167
- remainingNumberOfTries: { $gte: 1 }
166
+ }
168
167
  }, {
169
168
  $set: {
170
169
  status: factory_1.factory.taskStatus.Ready // 実行前に変更
@@ -198,7 +197,7 @@ class TaskDelayedRepo {
198
197
  .exec();
199
198
  }
200
199
  /**
201
- * $lte:0をReadyにする(特定のタスクを除いて) -> Readyにすれば自動的にAbortedになる
200
+ * $lte:0をReadyにする -> Readyにすれば自動的にAbortedになる
202
201
  */
203
202
  async retryAbortingTasks(params) {
204
203
  const lastTriedAtShoudBeLessThan = (0, moment_1.default)()
@@ -209,11 +208,11 @@ class TaskDelayedRepo {
209
208
  // @see schemas/task
210
209
  {
211
210
  status: { $eq: factory_1.factory.taskStatus.Running },
211
+ remainingNumberOfTries: { $lte: 0 },
212
212
  lastTriedAt: {
213
213
  $type: 'date',
214
214
  $lt: lastTriedAtShoudBeLessThan
215
- },
216
- remainingNumberOfTries: { $lte: 0 }
215
+ }
217
216
  }, {
218
217
  $set: {
219
218
  status: factory_1.factory.taskStatus.Ready // 実行前に変更
package/package.json CHANGED
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "26.0.0-alpha.17"
91
+ "version": "26.0.0-alpha.19"
92
92
  }