Explorer

definy.mcp-read-part-change

description
Read one change {part, type?, expression?, description?, delete?} of definy_create_snapshot
type
Fn(item: @definy.json) -> Union{#ok(@definy.mcp-part-change), #error(String)}
expression
fn(item$0) =>
  match @definy.json-get-string(value: $0, key: "part") {
    #none(_) =>
      #error("each change needs part ('module.name')"),
    #some(part$1) =>
      let dot$2 = @std.string-index-of(text: $1, target: ".", startIndex: 0);
      match @core.less-than(left: $2, right: 1) {
        true =>
          #error(@std.string-join(items: ["part must be in the form 'module.name': ", $1], separator: "")),
        false =>
          match @definy.mcp-read-visibility(text: @definy.json-get-string(value: $0, key: "visibility")) {
            #error(message$5) =>
              #error($5),
            #ok(visibility$6) =>
              #ok({
                part: $1,
                module_name: @core.string-slice(value: $1, start: 0, end: $2),
                name: @core.string-slice(value: $1, start: @core.plus(left: $2, right: 1), end: @core.string-length(value: $1)),
                delete: match @definy.json-get(value: $0, key: "delete") {
                  #some(value$3) =>
                    match $3 {
                      #boolean(flag$4) =>
                        $4,
                      _ =>
                        false
                    },
                  #none(_) =>
                    false
                },
                type_text: @definy.json-get-string(value: $0, key: "type"),
                expression_text: @definy.json-get-string(value: $0, key: "expression"),
                description: @definy.json-get-string(value: $0, key: "description"),
                visibility: $6,
                descriptions: @definy.mcp-read-descriptions(value: @definy.json-get(value: $0, key: "descriptions"))
              })
          }
      }
  }
visibility
public
definy.mcp-read-part-change (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: sbrliLUIKDP-wIeDGEgJInNj-QbvuMLsFiS8HzA8uVE
content hash: sNprlauJyGJ-ljfDULtpEcGX7oSxEGaXb4_i8cNB_TU