UNPKG

everything-dev

Version:

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

62 lines (60 loc) • 2.01 kB
const require_load = require("../services/resolution/load.cjs"); const require_published = require("../services/registry/published.cjs"); const require_verify = require("../services/deploy/verify.cjs"); let effect = require("effect"); //#region src/handlers/verify.ts function registerVerify(builder) { return { verify: builder.verify.effect(function* (_opts, input) { return yield* effect.Effect.promise(async () => { let authored = null; try { authored = await require_load.readAuthoredConfigInput(); } catch (error) { return { status: "fail", remotes: [], error: error instanceof Error ? error.message : String(error) }; } if (!authored) { const account = process.env.BOS_ACCOUNT; const gateway = process.env.BOS_GATEWAY; if (!account || !gateway) return { status: "fail", remotes: [], error: require_load.MISSING_CONFIG_MESSAGE }; try { authored = await require_published.resolvePublishedConfig(account, gateway); } catch (error) { return { status: "fail", remotes: [], error: error instanceof Error ? error.message : String(error) }; } if (!authored) return { status: "fail", remotes: [], error: `No config found at bos://${account}/${gateway} — verify BOS_ACCOUNT/BOS_GATEWAY and that the config has been published.` }; } const config = authored; const report = await require_verify.verifyPublishedPins({ config }); const freshness = await require_verify.verifyReleaseFreshness({ config, ...input.registry ? { registry: input.registry } : {} }); const rot = report.remotes.some((remote) => !remote.manifestOk || remote.mismatches.length > 0); const behind = freshness?.behind === true; return { status: rot ? "fail" : behind ? "drift" : "ok", remotes: report.remotes, ...freshness ? { freshness } : {} }; }); }) }; } //#endregion exports.registerVerify = registerVerify; //# sourceMappingURL=verify.cjs.map