All files / output zcl_abapgit_version.clas.mjs

56.6% Statements 180/318
54.9% Branches 28/51
20% Functions 6/30
56.6% Lines 180/318

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 3181x 1x 1x 1x 1x 1x 1x 1x 1x 1x         1x 1x         1x         1x 1x         1x         1x 1x 1x             1x       1x     1x 18x 18x 18x           18x 18x 18x           18x 18x 18x 1x 18x     18x 4x 18x 10x 10x 3x 3x 18x                                       18x     18x 1x     1x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x   24x 24x 24x 24x   24x 24x 24x 24x               24x 6x 24x 18x 18x 10x 18x 8x 8x 8x 8x     8x 18x 16x 24x 1x     1x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x 49x     49x 49x 146x 146x 146x 146x 49x 146x 49x 97x 48x 48x 146x             146x 49x 49x 49x 49x 49x                       49x       49x 1x     1x                                                       1x     1x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x     14x 2x 2x 12x 14x     12x 14x 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_version.clas.abap
class zcl_abapgit_version {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_VERSION';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"VERSION_TO_NUMERIC": {"visibility": "I", "parameters": {"RV_VERSION": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}, "IV_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "NORMALIZE": {"visibility": "U", "parameters": {"RV_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "CONV_STR_TO_VERSION": {"visibility": "U", "parameters": {"RS_VERSION": {"type": () => {return new abap.types.Structure({
  "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
  "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
  "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
  "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
  "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});}, "is_optional": " "}, "IV_VERSION": {"type": () => {return new abap.types.Character();}, "is_optional": " "}}},
  "CHECK_DEPENDANT_VERSION": {"visibility": "U", "parameters": {"IS_CURRENT": {"type": () => {return new abap.types.Structure({
  "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
  "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
  "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
  "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
  "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});}, "is_optional": " "}, "IS_DEPENDANT": {"type": () => {return new abap.types.Structure({
  "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
  "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
  "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
  "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
  "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});}, "is_optional": " "}}},
  "COMPARE": {"visibility": "U", "parameters": {"RV_RESULT": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}, "IV_A": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_B": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IS_A": {"type": () => {return new abap.types.Structure({
  "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
  "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
  "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
  "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
  "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});}, "is_optional": " "}, "IS_B": {"type": () => {return new abap.types.Structure({
  "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
  "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
  "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
  "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
  "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});}, "is_optional": " "}}},
  "GET_VERSION_CONSTANT_VALUE": {"visibility": "U", "parameters": {"RV_VERSION": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_VERSION_CONSTANT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async check_dependant_version(INPUT) {
    return zcl_abapgit_version.check_dependant_version(INPUT);
  }
  static async check_dependant_version(INPUT) {
    let is_current = INPUT?.is_current;
    if (is_current?.getQualifiedName === undefined || is_current.getQualifiedName() !== "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION") { is_current = undefined; }
    if (is_current === undefined) { is_current = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {}).set(INPUT.is_current); }
    let is_dependant = INPUT?.is_dependant;
    if (is_dependant?.getQualifiedName === undefined || is_dependant.getQualifiedName() !== "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION") { is_dependant = undefined; }
    if (is_dependant === undefined) { is_dependant = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {}).set(INPUT.is_dependant); }
    let lc_message = new abap.types.String({qualifiedName: "STRING"});
    lc_message.set('Current version is older than required');
    if (abap.compare.gt(is_dependant.get().major, is_current.get().major)) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
    } else if (abap.compare.lt(is_dependant.get().major, is_current.get().major)) {
      return;
    }
    if (abap.compare.gt(is_dependant.get().minor, is_current.get().minor)) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
    } else if (abap.compare.lt(is_dependant.get().minor, is_current.get().minor)) {
      return;
    }
    if (abap.compare.gt(is_dependant.get().patch, is_current.get().patch)) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
    } else if (abap.compare.lt(is_dependant.get().patch, is_current.get().patch)) {
      return;
    }
    if (abap.compare.initial(is_current.get().prerelase)) {
      return;
    }
    let unique570 = is_current.get().prerelase;
    if (abap.compare.eq(unique570, abap.CharacterFactory.get(2, 'rc'))) {
      if (abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(1, ''))) {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
      }
    } else if (abap.compare.eq(unique570, abap.CharacterFactory.get(4, 'beta'))) {
      if (abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(1, '')) || abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(2, 'rc'))) {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
      }
    } else if (abap.compare.eq(unique570, abap.CharacterFactory.get(5, 'alpha'))) {
      if (abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(1, '')) || abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(2, 'rc')) || abap.compare.eq(is_dependant.get().prerelase, abap.CharacterFactory.get(4, 'beta'))) {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
      }
    }
    if (abap.compare.eq(is_dependant.get().prerelase, is_current.get().prerelase) && abap.compare.gt(is_dependant.get().prerelase_patch, is_current.get().prerelase_patch)) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lc_message});
    }
  }
  async compare(INPUT) {
    return zcl_abapgit_version.compare(INPUT);
  }
  static async compare(INPUT) {
    let rv_result = new abap.types.Integer({qualifiedName: "I"});
    let iv_a = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.iv_a) {iv_a.set(INPUT.iv_a);}
    let iv_b = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.iv_b) {iv_b.set(INPUT.iv_b);}
    let is_a = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});
    if (INPUT && INPUT.is_a) {is_a.set(INPUT.is_a);}
    let is_b = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});
    if (INPUT && INPUT.is_b) {is_b.set(INPUT.is_b);}
    let ls_version_a = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});
    let ls_version_b = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});
    try {
      if (abap.compare.initial(is_a) === false) {
        ls_version_a.set(is_a);
      } else {
        ls_version_a.set((await this.conv_str_to_version({iv_version: iv_a})));
      }
      if (abap.compare.initial(is_b) === false) {
        ls_version_b.set(is_b);
      } else {
        ls_version_b.set((await this.conv_str_to_version({iv_version: iv_b})));
      }
    } catch (e) {
      if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
        rv_result.set(abap.IntegerFactory.get(0));
        return rv_result;
      } else {
        throw e;
      }
    }
    if (abap.compare.eq(ls_version_a, ls_version_b)) {
      rv_result.set(abap.IntegerFactory.get(0));
    } else {
      try {
        await this.check_dependant_version({is_current: ls_version_a, is_dependant: ls_version_b});
        rv_result.set(abap.IntegerFactory.get(1));
      } catch (e) {
        if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
          rv_result.set(abap.IntegerFactory.get(-1));
          return rv_result;
        } else {
          throw e;
        }
      }
    }
    return rv_result;
  }
  async conv_str_to_version(INPUT) {
    return zcl_abapgit_version.conv_str_to_version(INPUT);
  }
  static async conv_str_to_version(INPUT) {
    let rs_version = new abap.types.Structure({
    "major": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MAJOR"}),
    "minor": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-MINOR"}),
    "patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PATCH"}),
    "prerelase": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE"}),
    "prerelase_patch": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_VERSION-PRERELASE_PATCH"})}, "zif_abapgit_definitions=>ty_version", undefined, {}, {});
    let iv_version = INPUT?.iv_version;
    let lt_segments = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");
    let lt_parts = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");
    let lv_segment = new abap.types.String({qualifiedName: "STRING"});
    abap.statements.split({source: iv_version, at: abap.CharacterFactory.get(1, '-'), table: lt_segments});
    abap.statements.readTable(lt_segments,{index: abap.IntegerFactory.get(1),
      into: lv_segment});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      return rs_version;
    }
    abap.statements.split({source: lv_segment, at: abap.CharacterFactory.get(1, '.'), table: lt_parts});
    for await (const unique571 of abap.statements.loop(lt_parts)) {
      lv_segment.set(unique571);
      try {
        let unique572 = abap.builtin.sy.get().tabix;
        if (abap.compare.eq(unique572, abap.IntegerFactory.get(1))) {
          rs_version.get().major.set(lv_segment);
        } else if (abap.compare.eq(unique572, abap.IntegerFactory.get(2))) {
          rs_version.get().minor.set(lv_segment);
        } else if (abap.compare.eq(unique572, abap.IntegerFactory.get(3))) {
          rs_version.get().patch.set(lv_segment);
        }
      } catch (e) {
        if ((abap.Classes['CX_SY_CONVERSION_NO_NUMBER'] && e instanceof abap.Classes['CX_SY_CONVERSION_NO_NUMBER'])) {
          await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(37, 'Incorrect format for Semantic Version')});
        } else {
          throw e;
        }
      }
    }
    abap.statements.readTable(lt_segments,{index: abap.IntegerFactory.get(2),
      into: lv_segment});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      return rs_version;
    }
    abap.statements.split({source: lv_segment, at: abap.CharacterFactory.get(1, '.'), table: lt_parts});
    for await (const unique573 of abap.statements.loop(lt_parts)) {
      lv_segment.set(unique573);
      let unique574 = abap.builtin.sy.get().tabix;
      if (abap.compare.eq(unique574, abap.IntegerFactory.get(1))) {
        rs_version.get().prerelase.set(lv_segment);
        abap.statements.translate(rs_version.get().prerelase, "LOWER");
      } else if (abap.compare.eq(unique574, abap.IntegerFactory.get(2))) {
        rs_version.get().prerelase_patch.set(lv_segment);
      }
    }
    if (abap.compare.ne(rs_version.get().prerelase, abap.CharacterFactory.get(2, 'rc')) && abap.compare.ne(rs_version.get().prerelase, abap.CharacterFactory.get(4, 'beta')) && abap.compare.ne(rs_version.get().prerelase, abap.CharacterFactory.get(5, 'alpha'))) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(37, 'Incorrect format for Semantic Version')});
    }
    return rs_version;
  }
  async get_version_constant_value(INPUT) {
    return zcl_abapgit_version.get_version_constant_value(INPUT);
  }
  static async get_version_constant_value(INPUT) {
    let rv_version = new abap.types.String({qualifiedName: "STRING"});
    let iv_version_constant = INPUT?.iv_version_constant;
    if (iv_version_constant?.getQualifiedName === undefined || iv_version_constant.getQualifiedName() !== "STRING") { iv_version_constant = undefined; }
    if (iv_version_constant === undefined) { iv_version_constant = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_version_constant); }
    let lv_version_class = new abap.types.Character(30, {"qualifiedName":"SEOCLSNAME","ddicName":"SEOCLSNAME","description":"SEOCLSNAME"});
    let lv_version_component = new abap.types.String({qualifiedName: "STRING"});
    let fs_lv_version_ = new abap.types.FieldSymbol(new abap.types.Character());
    if (abap.compare.np(iv_version_constant, abap.CharacterFactory.get(4, '*=>*'))) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(66, 'Version constant needs to use the format CLASS/INTERFACE=>CONSTANT')});
    }
    abap.statements.split({source: iv_version_constant, at: abap.CharacterFactory.get(2, '=>'), targets: [lv_version_class,lv_version_component]});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)) || abap.compare.initial(lv_version_class) || abap.compare.initial(lv_version_component)) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(33, 'Version constant cannot be parsed')});
    }
    await (await abap.Classes['ZCL_ABAPGIT_OO_FACTORY'].get_by_name({iv_object_name: lv_version_class})).get().zif_abapgit_oo_object_fnc$syntax_check({iv_object_name: lv_version_class});
    abap.statements.assign({target: fs_lv_version_, dynamicName: lv_version_class.get() + '=>' + lv_version_component.get(), dynamicSource: (() => {
        const name = lv_version_class.get().toLowerCase().replace(/[~\/]/g, "$").match(/[\w\$\/]+/)[0];
        try { return eval(name); } catch {}
        try { return eval("this." + name); } catch {}
    })()});
    if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      rv_version.set(fs_lv_version_);
    } else {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.operators.concat(new abap.types.String().set(`Could not access version at class ${abap.templateFormatting(lv_version_class)} component `),new abap.types.String().set(`${abap.templateFormatting(lv_version_component)}`))});
    }
    return rv_version;
  }
  async normalize(INPUT) {
    return zcl_abapgit_version.normalize(INPUT);
  }
  static async normalize(INPUT) {
    let rv_version = new abap.types.String({qualifiedName: "STRING"});
    let iv_version = INPUT?.iv_version;
    if (iv_version?.getQualifiedName === undefined || iv_version.getQualifiedName() !== "STRING") { iv_version = undefined; }
    if (iv_version === undefined) { iv_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_version); }
    let lc_version_pattern = new abap.types.String({qualifiedName: "STRING"});
    lc_version_pattern.set('^v?(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})\\s*$');
    let lc_prerelease_pattern = new abap.types.String({qualifiedName: "STRING"});
    lc_prerelease_pattern.set('^((rc|beta|alpha)\\.\\d{1,3})\\s*$');
    let lv_version = new abap.types.String({qualifiedName: "STRING"});
    let lv_prerelease = new abap.types.String({qualifiedName: "STRING"});
    let lv_version_n = new abap.types.String({qualifiedName: "STRING"});
    let lv_prerelease_n = new abap.types.String({qualifiedName: "STRING"});
    abap.statements.split({source: iv_version, at: abap.CharacterFactory.get(1, '-'), targets: [lv_version,lv_prerelease]});
    abap.statements.find(lv_version, {regex: lc_version_pattern, first: true, submatches: [lv_version_n]});
    if (abap.compare.initial(lv_prerelease) === false) {
      abap.statements.find(lv_prerelease, {regex: lc_prerelease_pattern, first: true, submatches: [lv_prerelease_n]});
    }
    if (abap.compare.initial(lv_version_n)) {
      return rv_version;
    }
    rv_version.set(lv_version_n);
    if (abap.compare.initial(lv_prerelease_n) === false) {
      abap.statements.concatenate({source: [rv_version, abap.CharacterFactory.get(1, '-'), lv_prerelease_n], target: rv_version});
    }
    return rv_version;
  }
  async version_to_numeric(INPUT) {
    return zcl_abapgit_version.version_to_numeric(INPUT);
  }
  static async version_to_numeric(INPUT) {
    let rv_version = new abap.types.Integer({qualifiedName: "I"});
    let iv_version = INPUT?.iv_version;
    if (iv_version?.getQualifiedName === undefined || iv_version.getQualifiedName() !== "STRING") { iv_version = undefined; }
    if (iv_version === undefined) { iv_version = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_version); }
    let lv_major = new abap.types.Numc({length: 4});
    let lv_minor = new abap.types.Numc({length: 4});
    let lv_release = new abap.types.Numc({length: 4});
    abap.statements.split({source: iv_version, at: abap.CharacterFactory.get(1, '.'), targets: [lv_major,lv_minor,lv_release]});
    rv_version.set(abap.operators.add(abap.operators.add(abap.operators.multiply(lv_major,new abap.types.Integer().set(1000000)),abap.operators.multiply(lv_minor,new abap.types.Integer().set(1000))),lv_release));
    return rv_version;
  }
}
abap.Classes['ZCL_ABAPGIT_VERSION'] = zcl_abapgit_version;
export {zcl_abapgit_version};