All files / output zcl_abapgit_repo_news.clas.mjs

33.95% Statements 110/324
90.32% Branches 28/31
14.28% Functions 3/21
33.95% Lines 110/324

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 3241x 1x                               1x         1x 1x         1x 1x 1x         1x 1x 1x 1x 1x                                                                                                                                                                                                                                                                                                                                                                             3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 36x 36x 36x 20x 20x 36x 3x 3x 1x 1x 3x 36x 8x 5x 3x 5x 2x 2x 5x 6x 8x 8x 8x 14x 14x 3x 3x         43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 43x 20x 20x 23x 43x 10x 10x 10x 10x 43x 13x 13x 13x 23x 23x 43x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_repo_news.clas.abap
class zcl_abapgit_repo_news {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_REPO_NEWS';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MT_LOG": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
  "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
  "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_CURRENT_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_LASTSEEN_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MV_LATEST_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "C_TAIL_LENGTH": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}};
  static METHODS = {"LATEST_VERSION": {"visibility": "I", "parameters": {"RV_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "PARSE_LINE": {"visibility": "I", "parameters": {"RS_LOG": {"type": () => {return new abap.types.Structure({
  "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
  "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
  "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {});}, "is_optional": " "}, "IV_LINE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_CURRENT_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "PARSE": {"visibility": "I", "parameters": {"RT_LOG": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
  "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
  "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");}, "is_optional": " "}, "IT_LINES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");}, "is_optional": " "}, "IV_CURRENT_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "CREATE": {"visibility": "U", "parameters": {"RO_INSTANCE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS", RTTIName: "\\CLASS=ZCL_ABAPGIT_REPO_NEWS"});}, "is_optional": " "}, "II_REPO": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO"});}, "is_optional": " "}}},
  "GET_LOG": {"visibility": "U", "parameters": {"RT_LOG": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
  "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
  "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
  "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");}, "is_optional": " "}}},
  "HAS_NEWS": {"visibility": "U", "parameters": {"RV_BOOLEAN": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}},
  "HAS_IMPORTANT": {"visibility": "U", "parameters": {"RV_BOOLEAN": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}},
  "HAS_UPDATES": {"visibility": "U", "parameters": {"RV_BOOLEAN": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}},
  "HAS_UNSEEN": {"visibility": "U", "parameters": {"RV_BOOLEAN": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}},
  "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_RAWDATA": {"type": () => {return new abap.types.XString({qualifiedName: "XSTRING"});}, "is_optional": " "}, "IV_LASTSEEN_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_CURRENT_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}};
  #mt_log;
  #mv_current_version;
  #mv_lastseen_version;
  #mv_latest_version;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "latest_version": this.#latest_version.bind(this),
      "get_log": this.get_log.bind(this),
      "has_news": this.has_news.bind(this),
      "has_important": this.has_important.bind(this),
      "has_updates": this.has_updates.bind(this),
      "has_unseen": this.has_unseen.bind(this),
    };
    this.#mt_log = abap.types.TableFactory.construct(new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");
    this.FRIENDS_ACCESS_INSTANCE["mt_log"] = this.#mt_log;
    this.#mv_current_version = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_current_version"] = this.#mv_current_version;
    this.#mv_lastseen_version = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_lastseen_version"] = this.#mv_lastseen_version;
    this.#mv_latest_version = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_latest_version"] = this.#mv_latest_version;
    this.c_tail_length = zcl_abapgit_repo_news.c_tail_length;
  }
  async constructor_(INPUT) {
    let iv_rawdata = INPUT?.iv_rawdata;
    if (iv_rawdata?.getQualifiedName === undefined || iv_rawdata.getQualifiedName() !== "XSTRING") { iv_rawdata = undefined; }
    if (iv_rawdata === undefined) { iv_rawdata = new abap.types.XString({qualifiedName: "XSTRING"}).set(INPUT.iv_rawdata); }
    let iv_lastseen_version = INPUT?.iv_lastseen_version;
    if (iv_lastseen_version?.getQualifiedName === undefined || iv_lastseen_version.getQualifiedName() !== "STRING") { iv_lastseen_version = undefined; }
    if (iv_lastseen_version === undefined) { iv_lastseen_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_lastseen_version); }
    let iv_current_version = INPUT?.iv_current_version;
    if (iv_current_version?.getQualifiedName === undefined || iv_current_version.getQualifiedName() !== "STRING") { iv_current_version = undefined; }
    if (iv_current_version === undefined) { iv_current_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_current_version); }
    let lt_lines = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE");
    let lv_string = new abap.types.String({qualifiedName: "STRING"});
    let ls_log_line = new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {});
    this.#mv_current_version.set((await abap.Classes['ZCL_ABAPGIT_VERSION'].normalize({iv_version: iv_current_version})));
    this.#mv_lastseen_version.set((await abap.Classes['ZCL_ABAPGIT_VERSION'].normalize({iv_version: iv_lastseen_version})));
    if (abap.compare.initial(this.#mv_current_version)) {
      return this;
    }
    lv_string.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].xstring_to_string_utf8({iv_data: iv_rawdata})));
    lt_lines.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].split_string({iv_string: lv_string})));
    this.#mt_log.set((await this.parse({it_lines: lt_lines, iv_current_version: this.#mv_current_version})));
    abap.statements.readTable(this.#mt_log,{index: abap.IntegerFactory.get(1),
      into: ls_log_line});
    this.#mv_latest_version.set(ls_log_line.get().version);
    return this;
  }
  async create(INPUT) {
    return zcl_abapgit_repo_news.create(INPUT);
  }
  static async create(INPUT) {
    let ro_instance = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS", RTTIName: "\\CLASS=ZCL_ABAPGIT_REPO_NEWS"});
    let ii_repo = INPUT?.ii_repo;
    if (ii_repo?.getQualifiedName === undefined || ii_repo.getQualifiedName() !== "ZIF_ABAPGIT_REPO") { ii_repo = undefined; }
    if (ii_repo === undefined) { ii_repo = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO"}).set(INPUT.ii_repo); }
    let lc_log_path = new abap.types.String({qualifiedName: "STRING"});
    lc_log_path.set('/');
    let lc_log_filename = new abap.types.String({qualifiedName: "STRING"});
    lc_log_filename.set('changelog*');
    let lc_log_filename_up = new abap.types.String({qualifiedName: "STRING"});
    lc_log_filename_up.set('CHANGELOG*');
    let lo_apack = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_APACK_READER", RTTIName: "\\CLASS=ZCL_ABAPGIT_APACK_READER"});
    let lt_remote = abap.types.TableFactory.construct(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE_SIGNATURE-PATH"}),
    "filename": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE_SIGNATURE-FILENAME"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE-DATA"})}, "zif_abapgit_git_definitions=>ty_file", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"file_path","type":"SORTED","isUnique":true,"keyFields":["PATH","FILENAME"]},{"name":"file","type":"SORTED","isUnique":false,"keyFields":["FILENAME"]}]}, "zif_abapgit_git_definitions=>ty_files_tt");
    let lv_version = new abap.types.String({qualifiedName: "STRING"});
    let lv_last_seen = new abap.types.String({qualifiedName: "STRING"});
    let lv_url = new abap.types.String({qualifiedName: "STRING"});
    let li_repo_online = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_REPO_ONLINE", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_REPO_ONLINE"});
    let lv_version_constant = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DOT_ABAPGIT=>TY_DOT_ABAPGIT-VERSION_CONSTANT"});
    let fs_ls_file_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE_SIGNATURE-PATH"}),
    "filename": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE_SIGNATURE-FILENAME"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_FILE-DATA"})}, "zif_abapgit_git_definitions=>ty_file", undefined, {}, {}));
    if (abap.compare.eq((await ii_repo.get().zif_abapgit_repo$is_offline()), abap.builtin.abap_true)) {
      return ro_instance;
    }
    await abap.statements.cast(li_repo_online, ii_repo);
    lv_url.set((await li_repo_online.get().zif_abapgit_repo_online$get_url()));
    lo_apack.set((await ii_repo.get().zif_abapgit_repo$get_dot_apack()));
    if (abap.compare.initial(lo_apack) === false) {
      lv_version.set(((await lo_apack.get().get_manifest_descriptor())).get().version);
    }
    if (abap.compare.initial(lv_version)) {
      try {
        lv_version_constant.set((await (await ii_repo.get().zif_abapgit_repo$get_dot_abapgit()).get().get_version_constant()));
        if (abap.compare.initial(lv_version_constant) === false) {
          lv_version.set((await abap.Classes['ZCL_ABAPGIT_VERSION'].get_version_constant_value({iv_version_constant: lv_version_constant})));
        }
      } catch (e) {
        if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
          lv_version.clear();
        } else {
          throw e;
        }
      }
    }
    if (abap.compare.initial(lv_version)) {
      return ro_instance;
    }
    lv_last_seen.set((await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user()).get().zif_abapgit_persist_user$get_repo_last_change_seen({iv_url: lv_url})));
    try {
      lt_remote.set((await ii_repo.get().zif_abapgit_repo$get_files_remote()));
    } catch (e) {
      if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
        return ro_instance;
      } else {
        throw e;
      }
    }
    for await (const unique565 of abap.statements.loop(lt_remote,{where: async (I) => {return abap.compare.eq(I.path, lc_log_path) && (abap.compare.cp(I.filename, lc_log_filename) || abap.compare.cp(I.filename, lc_log_filename_up));},topEquals: {"path": lc_log_path}})) {
      fs_ls_file_.assign(unique565);
      ro_instance.set(await (new abap.Classes['ZCL_ABAPGIT_REPO_NEWS']()).constructor_({iv_rawdata: fs_ls_file_.get().data, iv_current_version: lv_version, iv_lastseen_version: (await abap.Classes['ZCL_ABAPGIT_VERSION'].normalize({iv_version: lv_last_seen}))}));
      break;
    }
    if (abap.compare.initial(ro_instance) === false && abap.compare.ne(lv_last_seen, (await ro_instance.get().FRIENDS_ACCESS_INSTANCE["latest_version"]()))) {
      await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user()).get().zif_abapgit_persist_user$set_repo_last_change_seen({iv_url: lv_url, iv_version: (await ro_instance.get().FRIENDS_ACCESS_INSTANCE["latest_version"]())});
    }
    return ro_instance;
  }
  async get_log() {
    let rt_log = abap.types.TableFactory.construct(new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");
    rt_log.set(this.#mt_log);
    return rt_log;
  }
  async has_important() {
    let rv_boolean = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    abap.statements.readTable(this.#mt_log,{withKey: (i) => {return abap.compare.eq(i.is_important, abap.builtin.abap_true);},
      withKeyValue: [{key: (i) => {return i.is_important}, value: abap.builtin.abap_true}],
      usesTableLine: false,
      withKeySimple: {"is_important": abap.builtin.abap_true}});
    rv_boolean.set(abap.builtin.boolc(abap.compare.initial(abap.builtin.sy.get().subrc)));
    return rv_boolean;
  }
  async has_news() {
    let rv_boolean = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    rv_boolean.set(abap.builtin.boolc(abap.compare.gt(abap.builtin.lines({val: this.#mt_log}), abap.IntegerFactory.get(0))));
    return rv_boolean;
  }
  async has_unseen() {
    let rv_boolean = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    rv_boolean.set(abap.builtin.boolc(abap.compare.gt((await abap.Classes['ZCL_ABAPGIT_VERSION'].compare({iv_a: this.#mv_latest_version, iv_b: this.#mv_lastseen_version})), abap.IntegerFactory.get(0))));
    return rv_boolean;
  }
  async has_updates() {
    let rv_boolean = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    rv_boolean.set(abap.builtin.boolc(abap.compare.gt((await abap.Classes['ZCL_ABAPGIT_VERSION'].compare({iv_a: this.#mv_latest_version, iv_b: this.#mv_current_version})), abap.IntegerFactory.get(0))));
    return rv_boolean;
  }
  async #latest_version() {
    let rv_version = new abap.types.String({qualifiedName: "STRING"});
    rv_version.set(this.#mv_latest_version);
    return rv_version;
  }
  async parse(INPUT) {
    return zcl_abapgit_repo_news.parse(INPUT);
  }
  static async parse(INPUT) {
    let rt_log = abap.types.TableFactory.construct(new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");
    let it_lines = INPUT?.it_lines;
    if (it_lines?.getQualifiedName === undefined || it_lines.getQualifiedName() !== "STRING_TABLE") { it_lines = undefined; }
    if (it_lines === undefined) { it_lines = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "STRING_TABLE").set(INPUT.it_lines); }
    let iv_current_version = INPUT?.iv_current_version;
    if (iv_current_version?.getQualifiedName === undefined || iv_current_version.getQualifiedName() !== "STRING") { iv_current_version = undefined; }
    if (iv_current_version === undefined) { iv_current_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_current_version); }
    let lv_tail = new abap.types.Integer({qualifiedName: "I"});
    let lv_first_version_found = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    let lv_version = new abap.types.String({qualifiedName: "STRING"});
    let ls_log = new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {});
    let fs_lv_line_ = new abap.types.FieldSymbol(new abap.types.String({qualifiedName: "STRING"}));
    for await (const unique566 of abap.statements.loop(it_lines)) {
      fs_lv_line_.assign(unique566);
      ls_log.set((await this.parse_line({iv_line: fs_lv_line_, iv_current_version: iv_current_version})));
      if (!(abap.compare.initial(ls_log) === false && (abap.compare.eq(lv_first_version_found, abap.builtin.abap_true) || abap.compare.initial(ls_log.get().version) === false))) {
        continue;
      }
      if (abap.compare.eq(lv_first_version_found, abap.builtin.abap_false)) {
        lv_first_version_found.set(abap.builtin.abap_true);
        if (abap.compare.le((await abap.Classes['ZCL_ABAPGIT_VERSION'].compare({iv_a: ls_log.get().version, iv_b: iv_current_version})), abap.IntegerFactory.get(0))) {
          lv_tail.set(zcl_abapgit_repo_news.c_tail_length);
        }
      }
      if (abap.compare.eq(ls_log.get().is_header, abap.builtin.abap_true)) {
        if (abap.compare.le((await abap.Classes['ZCL_ABAPGIT_VERSION'].compare({iv_a: ls_log.get().version, iv_b: iv_current_version})), abap.IntegerFactory.get(0))) {
          if (abap.compare.gt(lv_tail, abap.IntegerFactory.get(0))) {
            lv_tail.set(abap.operators.minus(lv_tail,abap.IntegerFactory.get(1)));
          } else {
            break;
          }
        }
        lv_version.set(ls_log.get().version);
      } else {
        ls_log.get().version.set(lv_version);
      }
      abap.statements.append({source: ls_log, target: rt_log});
    }
    return rt_log;
  }
  async parse_line(INPUT) {
    return zcl_abapgit_repo_news.parse_line(INPUT);
  }
  static async parse_line(INPUT) {
    let rs_log = new abap.types.Structure({
    "version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
    "pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
    "is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {});
    let iv_line = INPUT?.iv_line;
    if (iv_line?.getQualifiedName === undefined || iv_line.getQualifiedName() !== "STRING") { iv_line = undefined; }
    if (iv_line === undefined) { iv_line = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_line); }
    let iv_current_version = INPUT?.iv_current_version;
    if (iv_current_version?.getQualifiedName === undefined || iv_current_version.getQualifiedName() !== "STRING") { iv_current_version = undefined; }
    if (iv_current_version === undefined) { iv_current_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_current_version); }
    let lc_header_pattern = new abap.types.String({qualifiedName: "STRING"});
    lc_header_pattern.set('^\\d{4}-\\d{2}-\\d{2}\\s+v(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\s*$');
    let lv_version = new abap.types.String({qualifiedName: "STRING"});
    if (abap.compare.initial(iv_line) || abap.compare.co(iv_line, abap.CharacterFactory.get(3, ' -='))) {
      return rs_log;
    }
    abap.statements.find(iv_line, {regex: lc_header_pattern, first: true, submatches: [lv_version]});
    if (abap.compare.initial(abap.builtin.sy.get().subrc)) {
      lv_version.set((await abap.Classes['ZCL_ABAPGIT_VERSION'].normalize({iv_version: lv_version})));
      rs_log.get().version.set(lv_version);
      rs_log.get().is_header.set(abap.builtin.abap_true);
      rs_log.get().pos_to_cur.set((await abap.Classes['ZCL_ABAPGIT_VERSION'].compare({iv_a: lv_version, iv_b: iv_current_version})));
    } else {
      abap.statements.find(iv_line, {regex: abap.CharacterFactory.get(5, '^\\s*!'), first: true});
      rs_log.get().is_important.set(abap.builtin.boolc(abap.compare.initial(abap.builtin.sy.get().subrc)));
    }
    rs_log.get().text.set(iv_line);
    return rs_log;
  }
}
abap.Classes['ZCL_ABAPGIT_REPO_NEWS'] = zcl_abapgit_repo_news;
zcl_abapgit_repo_news.c_tail_length = new abap.types.Integer({qualifiedName: "I"});
zcl_abapgit_repo_news.c_tail_length.set(5);
zcl_abapgit_repo_news.ty_log = new abap.types.Structure({
"version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
"pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
"is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
"is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
"text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {});
zcl_abapgit_repo_news.ty_logs = abap.types.TableFactory.construct(new abap.types.Structure({
"version": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-VERSION"}),
"pos_to_cur": new abap.types.Integer({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-POS_TO_CUR"}),
"is_header": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
"is_important": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
"text": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_REPO_NEWS=>TY_LOG-TEXT"})}, "zcl_abapgit_repo_news=>ty_log", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_repo_news=>ty_logs");
export {zcl_abapgit_repo_news};