@dudousxd/nestjs-durable-store-mikro-orm 0.28.1 → 0.29.0

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/dist/index.cjs CHANGED
@@ -1158,7 +1158,7 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
1158
1158
  });
1159
1159
  return rows.map(fromRunEntity);
1160
1160
  }
1161
- async listDueTimers(nowMs, namespace) {
1161
+ async listDueTimers(nowMs, namespace, limit) {
1162
1162
  const em = this.fork();
1163
1163
  const rows = await em.find(WorkflowRunEntity, {
1164
1164
  status: "suspended",
@@ -1169,6 +1169,13 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
1169
1169
  ...namespace !== void 0 ? {
1170
1170
  namespace
1171
1171
  } : {}
1172
+ }, {
1173
+ orderBy: {
1174
+ wakeAt: "asc"
1175
+ },
1176
+ ...limit !== void 0 ? {
1177
+ limit
1178
+ } : {}
1172
1179
  });
1173
1180
  return rows.map(fromRunEntity);
1174
1181
  }
@@ -1605,6 +1612,19 @@ var MikroOrmStateStore = class _MikroOrmStateStore {
1605
1612
  });
1606
1613
  return entity ? fromCheckpointEntity(entity) : void 0;
1607
1614
  }
1615
+ async countCheckpoints(runId, fromSeq, toSeq, statuses) {
1616
+ if (statuses.length === 0) return 0;
1617
+ return this.fork().count(StepCheckpointEntity, {
1618
+ runId,
1619
+ seq: {
1620
+ $gte: fromSeq,
1621
+ $lte: toSeq
1622
+ },
1623
+ status: {
1624
+ $in: statuses
1625
+ }
1626
+ });
1627
+ }
1608
1628
  async listCheckpointsByNamePrefix(runId, prefixes) {
1609
1629
  if (prefixes.length === 0) return [];
1610
1630
  const em = this.fork();