@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/daemon.js +13 -7
- package/dist/daemon.js.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -16514,15 +16514,21 @@ function pickUpdate(doc, current, opts) {
|
|
|
16514
16514
|
if (!latest) return { version: null, reason: "registry has no latest tag" };
|
|
16515
16515
|
if (!isNewer(latest, current)) return { version: null, reason: `up to date (${current})` };
|
|
16516
16516
|
const major = (v) => Number.parseInt(v.replace(/^v/, ""), 10);
|
|
16517
|
+
let best = null;
|
|
16518
|
+
for (const [v, when] of Object.entries(doc.time ?? {})) {
|
|
16519
|
+
if (!/^\d+\.\d+\.\d+$/.test(v)) continue;
|
|
16520
|
+
if (!isNewer(v, current) || isNewer(v, latest)) continue;
|
|
16521
|
+
if (!opts.allowMajor && major(v) !== major(current)) continue;
|
|
16522
|
+
const published = Date.parse(when);
|
|
16523
|
+
if (!Number.isFinite(published) || opts.now - published < opts.minAgeMs) continue;
|
|
16524
|
+
if (!best || isNewer(v, best)) best = v;
|
|
16525
|
+
}
|
|
16526
|
+
if (best) return { version: best };
|
|
16517
16527
|
if (!opts.allowMajor && major(latest) !== major(current)) {
|
|
16518
16528
|
return { version: null, reason: `${latest} is a new major; set [update] allow_major = true to take it` };
|
|
16519
16529
|
}
|
|
16520
|
-
|
|
16521
|
-
|
|
16522
|
-
if (opts.now - published < opts.minAgeMs) {
|
|
16523
|
-
return { version: null, reason: `${latest} is younger than min_age; waiting` };
|
|
16524
|
-
}
|
|
16525
|
-
return { version: latest };
|
|
16530
|
+
if (!Number.isFinite(Date.parse(doc.time?.[latest] ?? ""))) return { version: null, reason: `no publish time for ${latest}` };
|
|
16531
|
+
return { version: null, reason: `${latest} is younger than min_age, and nothing older is newer than ${current}; waiting` };
|
|
16526
16532
|
}
|
|
16527
16533
|
function installPlan(opts) {
|
|
16528
16534
|
const expected = `${import_node_path15.sep}lib${import_node_path15.sep}node_modules${import_node_path15.sep}@profullstack${import_node_path15.sep}threatcrush`;
|
|
@@ -16657,7 +16663,7 @@ var AutoUpdate = class {
|
|
|
16657
16663
|
minAgeMs: this.opts.settings.minAgeMs,
|
|
16658
16664
|
now: this.now()
|
|
16659
16665
|
});
|
|
16660
|
-
if (pick.version === null) return this.note(pick.reason,
|
|
16666
|
+
if (pick.version === null) return this.note(pick.reason, !pick.reason.startsWith("up to date"));
|
|
16661
16667
|
const target = pick.version;
|
|
16662
16668
|
const last = this.lastAttempt();
|
|
16663
16669
|
if (last?.version === target && this.now() - last.at < RETRY_AFTER_MS) {
|