Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise>>((resolve, reject) =>{
let apiConfig = this.gateway.getApiConfig(apiId);
if (!apiConfig) {
return reject(new Errors.NotFoundError("API not found"));
}
if (path) {
let stats = this.statsRecorder.createStats(Stats.getStatsKey(prefix, apiConfig.path, key))
stats.getLastOccurrences(count||24, path, ...extra)
.then(resolve)
.catch(reject);
}
else {
return reject(new Errors.ForbidenError("Path parameter is required."));
}
});
}
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.update(apiId, corsId, cors))
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.update(apiId, auth))
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.create(apiId, throttling))
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.update(apiId, proxy))
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.update(apiId, circuitbreakerId, circuitbreaker))
return new Promise>>((resolve, reject) => {
if (path) {
const stats = this.statsRecorder.createStats(Stats.getStatsKey(prefix, apiId, key));
stats.getLastOccurrences(count || 24, normalizePath(path), ...extra)
.then(resolve)
.catch(reject);
} else {
return reject(new Errors.ForbidenError('Path parameter is required.'));
}
});
}
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.create(apiId, group))
.catch(err => {
throw new Errors.ForbidenError(JSON.stringify(err));
})
.then(() => this.service.create(apiId, cache))