Keep checked execution groups and public catalog preparation cooperative
This commit is contained in:
@@ -1,22 +1,17 @@
|
||||
import { compileInspectionTemplates, type InspectionKernel } from "./inspection.js";
|
||||
import { hexDigest, type ExecutionPlan } from "./plan.js";
|
||||
import { clientContractCatalog, type ExecutionInstallation } from "./installation.js";
|
||||
import { hexDigestAsync, type ExecutionPlan } from "./plan.js";
|
||||
import type { ClientContractCatalog } from "./installation.js";
|
||||
import { publicOperationContract, publicQueryContract } from "./client-contracts.js";
|
||||
|
||||
/** Explicit public projection of checked inputs. Never serialize conformance
|
||||
* storage or package ports, or recompile a historical Candidate at runtime. */
|
||||
export function publicDefinitionSnapshot(
|
||||
* storage or package ports, or recompile a historical Candidate at runtime.
|
||||
* The caller supplies that Candidate's checked, cached public catalog. */
|
||||
export async function publicDefinitionSnapshot(
|
||||
plan: ExecutionPlan,
|
||||
installation: ExecutionInstallation,
|
||||
kernel: InspectionKernel,
|
||||
catalog: ClientContractCatalog,
|
||||
) {
|
||||
const workspace = plan.definition.workspace;
|
||||
const catalog = clientContractCatalog(
|
||||
plan,
|
||||
installation,
|
||||
installation.packages.map((pkg) => pkg.revision),
|
||||
kernel,
|
||||
);
|
||||
const rows = {
|
||||
atoms: workspace.atoms.map((atom) => ({ id: atom.id, name: atom.displayName, documentation: atom.documentation })),
|
||||
interfaces: workspace.interfaceImports.map((iface) => ({
|
||||
@@ -95,5 +90,5 @@ export function publicDefinitionSnapshot(
|
||||
{ id: string; [key: string]: unknown }[]
|
||||
>;
|
||||
for (const entries of Object.values(publicRows)) entries.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
||||
return { codec: "camino-definitions-v1" as const, id: hexDigest(publicRows), rows: publicRows };
|
||||
return { codec: "camino-definitions-v1" as const, id: await hexDigestAsync(publicRows), rows: publicRows };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user