fn(signed_event_bytes$0, then$1) =>
match @definy.decode-stored-snapshot(signed_event_bytes: $0) {
#none(_) =>
$1(input: #none, commit: #none),
#some(commit$2) =>
let parts$3 = @definy.snapshot-parts(modules: $2.modules, index: 0);
let hashes$4 = @core.list-map(
T: @definy.stored-snapshot-part,
U: String,
f: fn(item$5) =>
$5.content_hash,
xs: $3
);
@definy.read-snapshots(
then: fn(commits$6) =>
let latest$7 = @definy.latest-main-snapshots(commits: $6);
@definy.read-resolutions(
content_hashes: $4,
then: fn(resolutions$8) =>
@definy.read-definitions(
content_hashes: @definy.unresolved-hashes(hashes: $4, resolutions: $8),
then: fn(definitions$9) =>
match @definy.closure-references(parts: $3, resolutions: $8, definitions: $9, types_only: false) {
#fallback(_) =>
@definy.read-snapshot-check-input-full(
commit: $2,
parts: $3,
latest: $7,
then: fn(input$10, commit$11) =>
$1(input: $10, commit: $11)
),
#refs(refs$12) =>
let candidates$13 = @definy.closure-candidates(commits: $7, index: 0);
let project_module_ids$14 = @definy.project-module-ids(commits: $7, project_name: $2.project_name, index: 0);
@definy.latest-closure(
candidates: @definy.closure-candidate-index(candidates: $13),
frontier: @core.list-concat(
left: @core.list-concat(left: @definy.closure-implicit-roots, right: $12),
right: @definy.closure-module-part-ids(
candidates: $13,
module_ids: @core.list-concat(
left: @core.list-map(
T: @definy.stored-snapshot-module,
U: String,
f: fn(item$15) =>
$15.id,
xs: $2.modules
),
right: $14
),
index: 0,
result: []
)
),
selected: [],
found: [],
resolutions: [],
definitions: [],
then: fn(closure$16) =>
match $16 {
#none(_) =>
@definy.read-snapshot-check-input-full(
commit: $2,
parts: $3,
latest: $7,
then: fn(input$17, commit$18) =>
$1(input: $17, commit: $18)
),
#some(closure$19) =>
$1(
input: #some({
project_name: $2.project_name,
parts: @core.list-map(
T: @definy.stored-snapshot-part,
U: @definy.snapshot-check-source-part,
f: fn(item$20) =>
@definy.source-part-of(part: $20, definitions: $9),
xs: $3
),
latest_commits: @core.list-map(
T: @definy.closure-candidate,
U: @definy.latest-snapshot-source,
f: fn(item$21) =>
{
project_name: $21.project_name,
parts: [@definy.source-part-of(part: $21.part, definitions: $19.definitions)]
},
xs: $19.parts
),
project_module_ids: $14,
resolutions: @core.list-concat(left: $8, right: $19.resolutions)
}),
commit: #some($2)
)
}
)
}
)
)
)
}