koishi-plugin-echo-cave 1.29.12 → 1.29.13

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.
Files changed (2) hide show
  1. package/lib/index.cjs +4 -4
  2. package/package.json +1 -1
package/lib/index.cjs CHANGED
@@ -35368,8 +35368,8 @@ function buildReindexPlan(caves) {
35368
35368
  tempId: cave.id + offset
35369
35369
  }));
35370
35370
  }
35371
- function hasIdGaps(plan) {
35372
- return plan.some((item) => item.oldId !== item.newId);
35371
+ function hasSequentialPublicIds(caves) {
35372
+ return caves.every((cave, index) => cave.id === index + 1);
35373
35373
  }
35374
35374
  async function writeReindexBackup(backupDir, caves, mapping) {
35375
35375
  await import_node_fs2.promises.mkdir(backupDir, { recursive: true });
@@ -35429,7 +35429,7 @@ async function reindexCaveIds(ctx, session, cfg) {
35429
35429
  return session.text("commands.cave.admin.reindex.messages.noCaves");
35430
35430
  }
35431
35431
  const plan = buildReindexPlan(caves);
35432
- if (!hasIdGaps(plan)) {
35432
+ if (hasSequentialPublicIds(caves)) {
35433
35433
  return session.text("commands.cave.admin.reindex.messages.alreadySequential");
35434
35434
  }
35435
35435
  let backupPath;
@@ -35553,7 +35553,7 @@ async function runScheduledReindex(ctx, cfg) {
35553
35553
  return;
35554
35554
  }
35555
35555
  const plan = buildReindexPlan(caves);
35556
- if (!hasIdGaps(plan)) {
35556
+ if (hasSequentialPublicIds(caves)) {
35557
35557
  ctx.logger.info("Skipped scheduled cave reindex because IDs are already sequential.");
35558
35558
  return;
35559
35559
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-echo-cave",
3
3
  "description": "Group echo cave",
4
- "version": "1.29.12",
4
+ "version": "1.29.13",
5
5
  "main": "lib/index.cjs",
6
6
  "typings": "lib/index.d.ts",
7
7
  "type": "module",