UNPKG

@abaplint/core

Version:
66 lines 2.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebMIME = void 0; const xml_utils_1 = require("../xml_utils"); const _abstract_object_1 = require("./_abstract_object"); class WebMIME extends _abstract_object_1.AbstractObject { getType() { return "W3MI"; } getAllowedNaming() { return { maxLength: 40, allowNamespace: true, customRegex: new RegExp(/^[A-Z_-\d/<> ]+$/i), }; } getDescription() { var _a; this.parse(); return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.description; } getParameter(name) { var _a; this.parse(); return (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.params[name.toLowerCase()]; } getParameters() { var _a, _b; this.parse(); return (_b = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {}; } setDirty() { this.parsedXML = undefined; super.setDirty(); } getDataFile() { for (const f of this.getFiles()) { if (f.getFilename().includes(".data.")) { return f; } } return undefined; } parse() { var _a; if (this.parsedXML) { return { updated: false, runtime: 0 }; } const start = Date.now(); this.parsedXML = { params: {} }; const parsed = super.parseRaw2(); if (parsed === undefined || parsed.abapGit === undefined || parsed.abapGit["asx:abap"]["asx:values"] === undefined) { return { updated: false, runtime: 0 }; } this.parsedXML.description = parsed.abapGit["asx:abap"]["asx:values"].TEXT; for (const param of (0, xml_utils_1.xmlToArray)((_a = parsed.abapGit["asx:abap"]["asx:values"].PARAMS) === null || _a === void 0 ? void 0 : _a.WWWPARAMS)) { this.parsedXML.params[param.NAME.toLowerCase()] = param.VALUE; } const end = Date.now(); return { updated: true, runtime: end - start }; } } exports.WebMIME = WebMIME; //# sourceMappingURL=web_mime.js.map