Explorer

core.event-check-state-of

description
What the rules know about a project snapshot, from the snapshots the server has accepted: the latest snapshot of the branch, whether the account created the branch (made its first snapshot), and so on. See docs/branch.md and docs/project.md
type
Fn(commit: @core.project-snapshot, facts: @core.event-check-facts) -> @core.event-check-state
expression
fn(commit$0, facts$1) =>
  let commits$2 = $1.commits;
  let project_name$3 = $0.project_name;
  {
    account_created: $1.account_created,
    branch_latest_commit_hash: match @core.branch-latest-snapshot(commits: $2, project_name: $3, branch: $0.branch, index: 0, found: #none) {
      #none(_) =>
        #none,
      #some(latest$4) =>
        #some($4.event_hash)
    },
    is_branch_creator: match @core.branch-first-snapshot(commits: $2, project_name: $3, branch: $0.branch, index: 0, found: #none) {
      #none(_) =>
        false,
      #some(first$5) =>
        @core.equal(left: $5.account_id, right: $1.account_id)
    },
    merged_in_project: match $0.merged_commit_hash {
      #none(_) =>
        false,
      #some(merged$6) =>
        @core.project-has-snapshot(commits: $2, project_name: $3, hash: #some($6), index: 0)
    },
    modules_in_other_projects: @core.strings-in(
      items: @core.snapshot-module-names(modules: $0.modules, index: 0),
      set: @core.other-project-module-names(commits: $2, project_name: $3, index: 0),
      index: 0
    ),
    parent_in_project: match $0.parent_commit_hash {
      #none(_) =>
        false,
      #some(parent$7) =>
        @core.project-has-snapshot(commits: $2, project_name: $3, hash: #some($7), index: 0)
    },
    project_has_commits: @core.project-has-snapshot(commits: $2, project_name: $3, hash: #none, index: 0)
  }
visibility
public
core.event-check-state-of (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: e5bdK9_le24H_Ryyojd2UwDcjpaCjIa0KlOlCy8NtPI
content hash: 3uEib0No_DQ8Gtjm3UNwk0Jmlr625-4behYXWslM4uQ