mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
Normalize completed stable-file path, digest and length in one shared observation owner. Migrate thirteen identical provider projections while preserving their selected paths, schema checks and cleanup composition. Keep specialized metadata and worker reply observations at their existing owners. Validation: shared real-descriptor coverage and provider lifecycle tests passed; build, typecheck, lint and formatting passed.
22 lines
717 B
TypeScript
22 lines
717 B
TypeScript
import {
|
|
fileSnapshotPartialObservationSchema,
|
|
type FileSnapshotPartialObservation,
|
|
} from "../domain/fileSnapshotObservation.js";
|
|
import { completedStableArtifact } from "./readStableArtifact.js";
|
|
|
|
/** Completed file identity survives finalization; it does not establish decoded content. */
|
|
export const completedStableArtifactObservation = (
|
|
cause: unknown,
|
|
path: string,
|
|
): FileSnapshotPartialObservation | undefined => {
|
|
const snapshot = completedStableArtifact(cause);
|
|
return snapshot === undefined
|
|
? undefined
|
|
: fileSnapshotPartialObservationSchema.parse({
|
|
kind: "file-snapshot-hash",
|
|
path,
|
|
sha256: snapshot.sha256,
|
|
bytes: snapshot.bytes.length,
|
|
});
|
|
};
|