UNPKG

@sap/adp-abap

Version:

abap service for all yeoman generators

39 lines 2.03 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const axios_1 = __importDefault(require("axios")); const DestinationService_1 = __importDefault(require("./DestinationService")); class DiscoveryUtils { static isAbapSystem(destinationName, username, password) { return __awaiter(this, void 0, void 0, function* () { const response = yield axios_1.default.get(`${DestinationService_1.default.getH2OEnvParam()}/destinations/${destinationName}${this.DISCOVERY_URL}`, this.getRequestOptions(username, password)); return response.data.includes(this.FILTER.scheme) && response.data.includes(this.FILTER.term); }); } static getRequestOptions(username, password) { return { headers: { "Authorization": "Basic " + Buffer.from(`${username}:${password}`).toString("base64"), "Accept": "application/atomsvc+xml" } }; } } exports.default = DiscoveryUtils; DiscoveryUtils.DISCOVERY_URL = "/sap/bc/adt/discovery"; DiscoveryUtils.FILTER = { "scheme": "http://www.sap.com/adt/categories/ui_flex", "term": "dta_folder" }; //# sourceMappingURL=DiscoveryUtils.js.map