@profullstack/threatcrush 0.13.37 → 0.13.38

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.js CHANGED
@@ -42680,15 +42680,21 @@ function pickUpdate(doc, current, opts) {
42680
42680
  if (!latest) return { version: null, reason: "registry has no latest tag" };
42681
42681
  if (!isNewer(latest, current)) return { version: null, reason: `up to date (${current})` };
42682
42682
  const major = (v) => Number.parseInt(v.replace(/^v/, ""), 10);
42683
+ let best = null;
42684
+ for (const [v, when] of Object.entries(doc.time ?? {})) {
42685
+ if (!/^\d+\.\d+\.\d+$/.test(v)) continue;
42686
+ if (!isNewer(v, current) || isNewer(v, latest)) continue;
42687
+ if (!opts.allowMajor && major(v) !== major(current)) continue;
42688
+ const published = Date.parse(when);
42689
+ if (!Number.isFinite(published) || opts.now - published < opts.minAgeMs) continue;
42690
+ if (!best || isNewer(v, best)) best = v;
42691
+ }
42692
+ if (best) return { version: best };
42683
42693
  if (!opts.allowMajor && major(latest) !== major(current)) {
42684
42694
  return { version: null, reason: `${latest} is a new major; set [update] allow_major = true to take it` };
42685
42695
  }
42686
- const published = Date.parse(doc.time?.[latest] ?? "");
42687
- if (!Number.isFinite(published)) return { version: null, reason: `no publish time for ${latest}` };
42688
- if (opts.now - published < opts.minAgeMs) {
42689
- return { version: null, reason: `${latest} is younger than min_age; waiting` };
42690
- }
42691
- return { version: latest };
42696
+ if (!Number.isFinite(Date.parse(doc.time?.[latest] ?? ""))) return { version: null, reason: `no publish time for ${latest}` };
42697
+ return { version: null, reason: `${latest} is younger than min_age, and nothing older is newer than ${current}; waiting` };
42692
42698
  }
42693
42699
  function installPlan(opts) {
42694
42700
  const expected = `${import_node_path23.sep}lib${import_node_path23.sep}node_modules${import_node_path23.sep}@profullstack${import_node_path23.sep}threatcrush`;
@@ -42823,7 +42829,7 @@ var AutoUpdate = class {
42823
42829
  minAgeMs: this.opts.settings.minAgeMs,
42824
42830
  now: this.now()
42825
42831
  });
42826
- if (pick.version === null) return this.note(pick.reason, false);
42832
+ if (pick.version === null) return this.note(pick.reason, !pick.reason.startsWith("up to date"));
42827
42833
  const target = pick.version;
42828
42834
  const last = this.lastAttempt();
42829
42835
  if (last?.version === target && this.now() - last.at < RETRY_AFTER_MS) {