Explorer

definy.check-snapshot

description
If the signed event is a project snapshot, check it (definy.check-snapshot-input) and pass the reasons to reject it to then (empty if none or if it is not a project snapshot). The decoded snapshot is also passed to then (none if it is not a project snapshot)
type
Fn(
  signed_event_bytes: String,
  then: Fn(errors: List<String>, commit: Union{#none, #some(@definy.stored-snapshot)}) -> @definy.service-io
) -> @definy.service-io
expression
fn(signed_event_bytes$0, then$1) =>
  @definy.read-snapshot-check-input(
    signed_event_bytes: $0,
    then: fn(input$2, commit$10) =>
      match $2 {
        #none(_) =>
          $1(errors: [], commit: $10),
        #some(input$3) =>
          let resolution_index$9500 = @definy.resolution-index(resolutions: $3.resolutions);
          @definy.resolve-latest-snapshots(
            commits: $3.latest_commits,
            index: 0,
            latest: [],
            environment: [],
            then: fn(latest$6, environment$7, fresh$8) =>
              @definy.resolve-snapshot-contents(
                parts: $3.parts,
                then: fn(parts$4, fresh$9) =>
                  @definy.write-resolutions(
                    parts: @core.list-concat(left: $8, right: $9),
                    index: 0,
                    entries: [],
                    then: fn() =>
                      @definy.check-snapshot-input(
                        input: {
                          project_name: $3.project_name,
                          parts: $4,
                          environment: $7,
                          latest: $6,
                          project_module_ids: $3.project_module_ids,
                          resolutions: $3.resolutions
                        },
                        then: fn(errors$5) =>
                          $1(errors: $5, commit: $10)
                      )
                  ),
                resolutions: $9500
              ),
            resolutions: $9500,
            fresh: []
          )
      }
  )
visibility
public
definy.check-snapshot (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: nHquuKFZYoHyM-CTOgDhi7R5sMew0ekrz1hlUvJUI_4
content hash: HOGQiNQ9NfHCuNGq69hwicoZOQ5C54sXrxU0r1fSesQ