rollbar-backend: replace camelcase-keys
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
"@backstage/backend-common": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
"@types/express": "^4.17.6",
|
||||
"camelcase-keys": "^7.0.1",
|
||||
"camelize-ts": "^2.3.0",
|
||||
"compression": "^1.7.4",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Logger } from 'winston';
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
import camelize from 'camelize-ts';
|
||||
import { buildQuery } from '../util';
|
||||
import {
|
||||
RollbarItemCount,
|
||||
@@ -104,19 +104,22 @@ export class RollbarApi {
|
||||
);
|
||||
}
|
||||
|
||||
private async get<T extends {}>(url: string, accessToken?: string) {
|
||||
private async get<T extends {}>(
|
||||
url: string,
|
||||
accessToken?: string,
|
||||
): Promise<T> {
|
||||
const fullUrl = buildUrl(url);
|
||||
|
||||
if (this.logger) {
|
||||
this.logger.info(`Calling Rollbar REST API, ${fullUrl}`);
|
||||
}
|
||||
|
||||
return fetch(
|
||||
const res = await fetch(
|
||||
fullUrl,
|
||||
getRequestHeaders(accessToken || this.accessToken || ''),
|
||||
)
|
||||
.then(response => response.json())
|
||||
.then(json => camelcaseKeys<T>(json?.result, { deep: true }));
|
||||
);
|
||||
const data = await res.json();
|
||||
return camelize(data?.result) as T;
|
||||
}
|
||||
|
||||
private async getForProject<T extends {}>(
|
||||
|
||||
Reference in New Issue
Block a user