Explorer

definy.branch-items-json

description
The branches from index as the JSON of GetProjectBranches (ProjectBranchItem), with their latest events (events, in the same order) and the status of the branches other than main (core.branch-summary-status). Branches whose latest event is not found are left out
type
Fn(
  branches: List<@core.branch-summary>,
  events: List<Union{#none, #some(@definy.stored-event)}>,
  index: Number,
  records: List<@core.branch-status-record>,
  merges: List<@core.branch-merge>
) -> List<@definy.json>
expression
fn(branches$0, events$1, index$2, records$6, merges$7) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      [],
    #some(item$1005) =>
      let branch$3 = $1005;
      @core.list-concat(
        left: match @core.list-get(list: $1, index: $2) {
          #none(_) =>
            [],
          #some(element$3006) =>
            match $3006 {
              #none(_) =>
                [],
              #some(event$4) =>
                [
                  #object<@definy.json>(@core.list-concat(
                    left: [
                      {key: "projectName", value: #string<@definy.json>($3.project_name)},
                      {key: "branch", value: #string<@definy.json>($3.name)},
                      {key: "creatorAccountId", value: #string<@definy.json>($3.creator_account_id)},
                      {key: "commitCount", value: #number<@definy.json>($3.commit_count)},
                      {key: "latestEvent", value: @definy.stored-event-json(event: $4)}
                    ],
                    right: match @core.branch-summary-status(branch: $3, records: $6, merges: $7) {
                      #none(_) =>
                        [],
                      #some(status$8) =>
                        [{key: "status", value: #string<@definy.json>(@core.branch-status-name(status: $8))}]
                    }
                  ))
                ]
            }
        },
        right: @definy.branch-items-json(branches: $0, events: $1, index: @core.plus(left: $2, right: 1), records: $6, merges: $7)
      )
  }
visibility
public
definy.branch-items-json (project definy, branch release-time-compare, snapshot JJrRgQW_LZN6tN8CbYr1dN7HosqNTuIWWYx7ACbt1n0)
id: 9UmRXThprUdb8q-qLJzboQZ85N3lOqCsGFMujQ9uId0
content hash: JK3bMWh0ffKNY-VtHNySL4-8cxgB705eo6KXyjEVF_M