@chevre/domain 22.9.0-alpha.81 → 22.9.0-alpha.82

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.
@@ -15,11 +15,12 @@ async function main() {
15
15
  const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
16
16
 
17
17
  const { count } = await transactionRepo.count<chevre.factory.transactionType.PlaceOrder>({
18
- limit: 1000,
18
+ limit: 5000,
19
19
  // page: 1,
20
20
  // project: { id: { $eq: project.id } },
21
21
  typeOf: chevre.factory.transactionType.PlaceOrder,
22
- statuses: [chevre.factory.transactionStatusType.InProgress]
22
+ statuses: [chevre.factory.transactionStatusType.InProgress],
23
+ startThrough: new Date()
23
24
  });
24
25
  console.log('count:', count);
25
26
  }
@@ -220,7 +220,10 @@ export declare class TaskRepo {
220
220
  name: {
221
221
  $nin?: factory.taskName[];
222
222
  };
223
- }): Promise<number>;
223
+ limit?: number;
224
+ }): Promise<{
225
+ count: number;
226
+ }>;
224
227
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
225
228
  project: Pick<factory.project.IProject, "id" | "typeOf">;
226
229
  expires?: Date | undefined;
@@ -806,12 +806,17 @@ class TaskRepo {
806
806
  }
807
807
  countDelayedTasks(params) {
808
808
  return __awaiter(this, void 0, void 0, function* () {
809
+ const { limit } = params;
809
810
  const runsAtLt = moment()
810
811
  .add(-params.delayInSeconds, 'seconds')
811
812
  .toDate();
812
- return this.taskModel.countDocuments(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: runsAtLt } }, (Array.isArray(params.name.$nin)) ? { name: { $nin: params.name.$nin } } : undefined))
813
- .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
813
+ const query = this.taskModel.countDocuments(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: runsAtLt } }, (Array.isArray(params.name.$nin)) ? { name: { $nin: params.name.$nin } } : undefined));
814
+ if (typeof limit === 'number' && limit >= 0) {
815
+ query.limit(limit);
816
+ }
817
+ const count = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
814
818
  .exec();
819
+ return { count };
815
820
  });
816
821
  }
817
822
  getCursor(conditions, projection) {
@@ -201,7 +201,7 @@ function notifyByEmail(params) {
201
201
  personalizations: [{ to: emailDatas }],
202
202
  subject,
203
203
  custom_args: {
204
- emailMessage: 'taskAborted'
204
+ emailMessage: subject
205
205
  // actionId: action.id,
206
206
  // projectId: project.id
207
207
  }
package/package.json CHANGED
@@ -113,5 +113,5 @@
113
113
  "postversion": "git push origin --tags",
114
114
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
115
115
  },
116
- "version": "22.9.0-alpha.81"
116
+ "version": "22.9.0-alpha.82"
117
117
  }