@sectester/scan
Version:
The package defines a simple public API to manage scans and their expectations.
43 lines • 1.69 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultDiscoveries = void 0;
const tslib_1 = require("tslib");
const tsyringe_1 = require("tsyringe");
const core_1 = require("@sectester/core");
let DefaultDiscoveries = class DefaultDiscoveries {
constructor(configuration, client) {
this.configuration = configuration;
this.client = client;
}
async createEntrypoint(target, repeaterId) {
let response = await this.client.request(`/api/v2/projects/${this.configuration.projectId}/entry-points`, {
method: 'POST',
body: JSON.stringify({
repeaterId,
authObjectId: target.auth,
request: {
method: target.method,
url: target.url,
headers: target.headers,
body: await target.text()
}
}),
headers: {
'content-type': 'application/json'
}
});
if (response.status === 409 && response.headers.has('location')) {
const location = response.headers.get('location');
response = await this.client.request(location);
}
const data = (await response.json());
return data;
}
};
exports.DefaultDiscoveries = DefaultDiscoveries;
exports.DefaultDiscoveries = DefaultDiscoveries = tslib_1.__decorate([
(0, tsyringe_1.injectable)(),
tslib_1.__param(1, (0, tsyringe_1.inject)(core_1.ApiClient)),
tslib_1.__metadata("design:paramtypes", [core_1.Configuration, Object])
], DefaultDiscoveries);
//# sourceMappingURL=DefaultDiscoveries.js.map