UNPKG

everything-dev

Version:

A consolidated product package for building Module Federation apps with oRPC APIs.

46 lines (44 loc) • 1.58 kB
import { parseRuntimeRef } from "../registry/keys.mjs"; import { ManifestTagSchema } from "../platform/manifest-schema.mjs"; import { readManifestTag } from "../registry/pointer.mjs"; //#region src/services/deploy/verify.ts /** * The freshness half of the drift alarm: the authored `release` vs the * parent's live thin-tag release. Behind is advisory only — drift never * blocks a deploy, `bos upgrade && bos deploy` realigns. */ async function verifyReleaseFreshness(input) { const pinned = typeof input.config.release === "string" ? input.config.release : void 0; const extendsRef = typeof input.config.extends === "string" ? input.config.extends : void 0; if (!pinned || !extendsRef) return void 0; try { const ref = parseRuntimeRef(extendsRef); const tagBytes = await readManifestTag(ref.accountId, ref.gatewayId, input.registry); if (!tagBytes) return { behind: false, pinned, message: "the parent's release pointer is absent" }; const published = ManifestTagSchema.parse(tagBytes).version; return published === pinned ? { behind: false, pinned, published, message: `release ${pinned} is current` } : { behind: true, pinned, published, message: `parent release is ${published}, you target ${pinned} — run \`bos upgrade && bos deploy\` to realign` }; } catch (error) { return { behind: false, pinned, message: `freshness check failed (non-blocking): ${error instanceof Error ? error.message : String(error)}` }; } } //#endregion export { verifyReleaseFreshness }; //# sourceMappingURL=verify.mjs.map