{"version":3,"file":"verify.cjs","names":["parseRuntimeRef","readManifestTag","ManifestTagSchema"],"sources":["../../../src/services/deploy/verify.ts"],"sourcesContent":["import type { BosConfigInput } from \"../../types\";\nimport { ManifestTagSchema } from \"../platform/manifest-schema\";\nimport { parseRuntimeRef } from \"../registry/keys\";\nimport { readManifestTag } from \"../registry/pointer\";\nimport { type VerifyReport, verifyChain } from \"../verify/chain\";\n\n/**\n * The pin→bytes proof (#826 drift alarm, the 061 `bos verify` core): for\n * every pinned remote, SRI-verify the pinned version manifest document, then\n * hash every file the manifest's `files` map names against the bytes the CDN\n * serves — the manual curl+sha384 sweep, automated. A published pin that no\n * longer resolves byte-for-byte is the mixed-build rot that killed pinned\n * children; this names the file instead of a webpack TypeError.\n */\n\nexport type { VerifyFileMismatch, VerifyRemoteResult, VerifyReport } from \"../verify/chain\";\n\nexport async function verifyPublishedPins(input: {\n  config: BosConfigInput;\n  fetchImpl?: typeof fetch;\n}): Promise<VerifyReport> {\n  const chain = await verifyChain({\n    config: input.config,\n    depth: \"files\",\n    ...(input.fetchImpl !== undefined ? { fetchImpl: input.fetchImpl } : {}),\n  });\n  return { remotes: chain.remotes };\n}\n\nexport interface VerifyFreshness {\n  behind: boolean;\n  pinned?: string;\n  published?: string;\n  message: string;\n}\n\n/**\n * The freshness half of the drift alarm: the authored `release` vs the\n * parent's live thin-tag release. Behind is advisory only — drift never\n * blocks a deploy, `bos upgrade && bos deploy` realigns.\n */\nexport async function verifyReleaseFreshness(input: {\n  config: BosConfigInput;\n  registry?: string;\n}): Promise<VerifyFreshness | undefined> {\n  const pinned = typeof input.config.release === \"string\" ? input.config.release : undefined;\n  const extendsRef = typeof input.config.extends === \"string\" ? input.config.extends : undefined;\n  if (!pinned || !extendsRef) return undefined;\n  try {\n    const ref = parseRuntimeRef(extendsRef);\n    const tagBytes = await readManifestTag(ref.accountId, ref.gatewayId, input.registry);\n    if (!tagBytes) {\n      return { behind: false, pinned, message: \"the parent's release pointer is absent\" };\n    }\n    const published = ManifestTagSchema.parse(tagBytes).version;\n    return published === pinned\n      ? { behind: false, pinned, published, message: `release ${pinned} is current` }\n      : {\n          behind: true,\n          pinned,\n          published,\n          message: `parent release is ${published}, you target ${pinned} — run \\`bos upgrade && bos deploy\\` to realign`,\n        };\n  } catch (error) {\n    return {\n      behind: false,\n      pinned,\n      message: `freshness check failed (non-blocking): ${error instanceof Error ? error.message : String(error)}`,\n    };\n  }\n}\n"],"mappings":";;;;;;;;;;AAyCA,eAAsB,uBAAuB,OAGJ;CACvC,MAAM,SAAS,OAAO,MAAM,OAAO,YAAY,WAAW,MAAM,OAAO,UAAU;CACjF,MAAM,aAAa,OAAO,MAAM,OAAO,YAAY,WAAW,MAAM,OAAO,UAAU;CACrF,IAAI,CAAC,UAAU,CAAC,YAAY,OAAO;CACnC,IAAI;EACF,MAAM,MAAMA,6BAAgB,UAAU;EACtC,MAAM,WAAW,MAAMC,gCAAgB,IAAI,WAAW,IAAI,WAAW,MAAM,QAAQ;EACnF,IAAI,CAAC,UACH,OAAO;GAAE,QAAQ;GAAO;GAAQ,SAAS;EAAyC;EAEpF,MAAM,YAAYC,0CAAkB,MAAM,QAAQ,CAAC,CAAC;EACpD,OAAO,cAAc,SACjB;GAAE,QAAQ;GAAO;GAAQ;GAAW,SAAS,WAAW,OAAO;EAAa,IAC5E;GACE,QAAQ;GACR;GACA;GACA,SAAS,qBAAqB,UAAU,eAAe,OAAO;EAChE;CACN,SAAS,OAAO;EACd,OAAO;GACL,QAAQ;GACR;GACA,SAAS,0CAA0C,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC1G;CACF;AACF"}