Explorer

core.event-check-state-of

description
What the rules know about a project commit, from the commits the server has accepted: the latest commit of the branch, whether the account created the branch (made its first commit), and so on. See docs/branch.md and docs/project.md
type
Fn(commit: @core.project-commit, 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-commit(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-commit(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-commit(commits: $2, project_name: $3, hash: #some($6), index: 0)
    },
    modules_in_other_projects: @core.strings-in(
      items: @core.commit-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-commit(commits: $2, project_name: $3, hash: #some($7), index: 0)
    },
    project_has_commits: @core.project-has-commit(commits: $2, project_name: $3, hash: #none, index: 0)
  }
visibility
public
core.event-check-state-of (project definy, branch compiled-tests, snapshot i6TqClmqVS9FK8rKOvJ43l6Tevx8pvYJ5-zaQqNwemc)
id: e5bdK9_le24H_Ryyojd2UwDcjpaCjIa0KlOlCy8NtPI
content hash: WYzJDSr2nDHJlLuDMC8mM3wfL5F372Rne30i0ESA6MY