All files / output cl_abap_dyn_prg.clas.mjs

22.33% Statements 46/206
100% Branches 2/2
1.81% Functions 1/55
22.33% Lines 46/206

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 2061x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x                 1x     1x                                                     1x     1x                 1x     1x             1x     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");
// cl_abap_dyn_prg.clas.abap
class cl_abap_dyn_prg {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CL_ABAP_DYN_PRG';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"CHECK_TABLE_NAME_STR": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "PACKAGES": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "INCL_SUB_PACKAGES": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}}},
  "CHECK_WHITELIST_STR": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "WHITELIST": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "QUOTE": {"visibility": "U", "parameters": {"OUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "ESCAPE_QUOTES": {"visibility": "U", "parameters": {"OUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "ESCAPE_XSS_XML_HTML": {"visibility": "U", "parameters": {"OUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "ESCAPE_XSS_URL": {"visibility": "U", "parameters": {"OUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "CHECK_COLUMN_NAME": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "STRICT": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}}},
  "CHECK_VARIABLE_NAME": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "STRICT": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}}},
  "CHECK_TABLE_OR_VIEW_NAME_STR": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "PACKAGES": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "INCL_SUB_PACKAGES": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " ", "parm_kind": "I", "type_name": "CharacterType"}}},
  "ESCAPE_QUOTES_STR": {"visibility": "U", "parameters": {"OUT": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}}},
  "CHECK_WHITELIST_TAB": {"visibility": "U", "parameters": {"VAL_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "R", "type_name": "StringType"}, "VAL": {"type": () => {return new abap.types.Character();}, "is_optional": " ", "parm_kind": "I", "type_name": "CSequenceType"}, "WHITELIST": {"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_HASHED_TABLE");}, "is_optional": " ", "parm_kind": "I", "type_name": "TableType"}}}};
  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_variable_name(INPUT) {
    return cl_abap_dyn_prg.check_variable_name(INPUT);
  }
  static async check_variable_name(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let strict = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.strict) {strict.set(INPUT.strict);}
    if (INPUT === undefined || INPUT.strict === undefined) {strict = abap.builtin.abap_false;}
    abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
    return val_str;
  }
  async check_column_name(INPUT) {
    return cl_abap_dyn_prg.check_column_name(INPUT);
  }
  static async check_column_name(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let strict = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.strict) {strict.set(INPUT.strict);}
    if (INPUT === undefined || INPUT.strict === undefined) {strict = abap.builtin.abap_false;}
    let lv_check = new abap.types.String({qualifiedName: "STRING"});
    val_str.set(val);
    lv_check.set(val_str);
    abap.statements.translate(lv_check, "UPPER");
    if (abap.compare.initial(val_str)) {
      const unique1441 = await (new abap.Classes['CX_ABAP_INVALID_NAME']()).constructor_();
      unique1441.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_dyn_prg.clas.abap","INTERNAL_LINE": 105};
      throw unique1441;
    }
    if (abap.compare.eq(strict, abap.builtin.abap_true)) {
      abap.statements.find(lv_check, {regex: abap.CharacterFactory.get(43, '^([A-Z_][A-Z0-9_]*|/[A-Z0-9_]+/[A-Z0-9_]+)$')});
    } else {
      abap.statements.find(lv_check, {regex: abap.CharacterFactory.get(88, '^([A-Z_][A-Z0-9_]*|/[A-Z0-9_]+/[A-Z0-9_]+)(~([A-Z_][A-Z0-9_]*|/[A-Z0-9_]+/[A-Z0-9_]+))?$')});
    }
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      const unique1442 = await (new abap.Classes['CX_ABAP_INVALID_NAME']()).constructor_();
      unique1442.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_dyn_prg.clas.abap","INTERNAL_LINE": 115};
      throw unique1442;
    }
    return val_str;
  }
  async check_whitelist_tab(INPUT) {
    return cl_abap_dyn_prg.check_whitelist_tab(INPUT);
  }
  static async check_whitelist_tab(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let whitelist = INPUT?.whitelist;
    if (whitelist?.getQualifiedName === undefined || whitelist.getQualifiedName() !== "STRING_HASHED_TABLE") { whitelist = undefined; }
    if (whitelist === undefined) { whitelist = 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_HASHED_TABLE").set(INPUT.whitelist); }
    abap.statements.assert(abap.compare.eq(abap.IntegerFactory.get(1), abap.CharacterFactory.get(4, 'todo')));
    return val_str;
  }
  async escape_quotes_str(INPUT) {
    return cl_abap_dyn_prg.escape_quotes_str(INPUT);
  }
  static async escape_quotes_str(INPUT) {
    let out = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    out.set(val);
    abap.statements.replace({target: out, all: true, with: abap.CharacterFactory.get(2, '``'), of: abap.CharacterFactory.get(1, '`')});
    return out;
  }
  async check_table_or_view_name_str(INPUT) {
    return cl_abap_dyn_prg.check_table_or_view_name_str(INPUT);
  }
  static async check_table_or_view_name_str(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let packages = INPUT?.packages;
    let incl_sub_packages = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.incl_sub_packages) {incl_sub_packages.set(INPUT.incl_sub_packages);}
    if (INPUT === undefined || INPUT.incl_sub_packages === undefined) {incl_sub_packages = abap.builtin.abap_false;}
    let lv_check = new abap.types.String({qualifiedName: "STRING"});
    val_str.set(val);
    lv_check.set(val_str);
    abap.statements.translate(lv_check, "UPPER");
    if (abap.compare.initial(val_str) || abap.compare.gt(abap.builtin.strlen({val: val_str}), abap.IntegerFactory.get(30))) {
      const unique1443 = await (new abap.Classes['CX_ABAP_NOT_A_TABLE']()).constructor_();
      unique1443.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_dyn_prg.clas.abap","INTERNAL_LINE": 136};
      throw unique1443;
    }
    abap.statements.find(lv_check, {regex: abap.CharacterFactory.get(43, '^([A-Z_][A-Z0-9_]*|/[A-Z0-9_]+/[A-Z0-9_]+)$')});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      const unique1444 = await (new abap.Classes['CX_ABAP_NOT_A_TABLE']()).constructor_();
      unique1444.EXTRA_CX = {"INTERNAL_FILENAME": "cl_abap_dyn_prg.clas.abap","INTERNAL_LINE": 141};
      throw unique1444;
    }
    return val_str;
  }
  async check_table_name_str(INPUT) {
    return cl_abap_dyn_prg.check_table_name_str(INPUT);
  }
  static async check_table_name_str(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let packages = INPUT?.packages;
    let incl_sub_packages = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.incl_sub_packages) {incl_sub_packages.set(INPUT.incl_sub_packages);}
    val_str.set(val);
    return val_str;
  }
  async check_whitelist_str(INPUT) {
    return cl_abap_dyn_prg.check_whitelist_str(INPUT);
  }
  static async check_whitelist_str(INPUT) {
    let val_str = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let whitelist = INPUT?.whitelist;
    val_str.set(val);
    return val_str;
  }
  async quote(INPUT) {
    return cl_abap_dyn_prg.quote(INPUT);
  }
  static async quote(INPUT) {
    let out = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    out.set(abap.operators.concat(new abap.types.String().set(`'`),abap.operators.concat((await this.escape_quotes({val: val})),new abap.types.String().set(`'`))));
    return out;
  }
  async escape_xss_url(INPUT) {
    return cl_abap_dyn_prg.escape_xss_url(INPUT);
  }
  static async escape_xss_url(INPUT) {
    let out = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    out.set(encodeURIComponent(val.get().trimEnd()).replace(/[!''()]/g, c => "%" + c.charCodeAt(0).toString(16)).toLowerCase());
    return out;
  }
  async escape_quotes(INPUT) {
    return cl_abap_dyn_prg.escape_quotes(INPUT);
  }
  static async escape_quotes(INPUT) {
    let out = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    out.set(val);
    abap.statements.replace({target: out, all: true, with: new abap.types.String().set(`''`), of: new abap.types.String().set(`'`)});
    return out;
  }
  async escape_xss_xml_html(INPUT) {
    return cl_abap_dyn_prg.escape_xss_xml_html(INPUT);
  }
  static async escape_xss_xml_html(INPUT) {
    let out = new abap.types.String({qualifiedName: "STRING"});
    let val = INPUT?.val;
    let lv_index = new abap.types.Integer({qualifiedName: "I"});
    let lv_code = new abap.types.Integer({qualifiedName: "I"});
    let lv_hex = new abap.types.String({qualifiedName: "STRING"});
    out.set(abap.CharacterFactory.get(1, ''));
    const indexBackup1 = abap.builtin.sy.get().index.get();
    const unique1445 = abap.builtin.strlen({val: val}).get();
    for (let unique1446 = 0; unique1446 < unique1445; unique1446++) {
      abap.builtin.sy.get().index.set(unique1446 + 1);
      lv_index.set(abap.operators.minus(abap.builtin.sy.get().index,abap.IntegerFactory.get(1)));
      lv_code.set(val.get().charCodeAt(lv_index.get()));
      if (abap.compare.eq(lv_code, abap.IntegerFactory.get(60))) {
        out.set(abap.operators.concat(out,abap.CharacterFactory.get(4, '&lt;')));
      } else if (abap.compare.eq(lv_code, abap.IntegerFactory.get(62))) {
        out.set(abap.operators.concat(out,abap.CharacterFactory.get(4, '&gt;')));
      } else if (abap.compare.eq(lv_code, abap.IntegerFactory.get(38))) {
        out.set(abap.operators.concat(out,abap.CharacterFactory.get(5, '&amp;')));
      } else if ((abap.compare.ge(lv_code, abap.IntegerFactory.get(65)) && abap.compare.le(lv_code, abap.IntegerFactory.get(90))) || (abap.compare.ge(lv_code, abap.IntegerFactory.get(97)) && abap.compare.le(lv_code, abap.IntegerFactory.get(122))) || (abap.compare.ge(lv_code, abap.IntegerFactory.get(48)) && abap.compare.le(lv_code, abap.IntegerFactory.get(57)))) {
        out.set(out.get() + String.fromCharCode(lv_code.get()));
      } else {
        lv_hex.set(lv_code.get().toString(16));
        out.set(abap.operators.concat(out,abap.operators.concat(abap.CharacterFactory.get(3, '&#x'),abap.operators.concat(lv_hex,abap.CharacterFactory.get(1, ';')))));
      }
    }
    abap.builtin.sy.get().index.set(indexBackup1);
    return out;
  }
}
abap.Classes['CL_ABAP_DYN_PRG'] = cl_abap_dyn_prg;
export {cl_abap_dyn_prg};