@@ -52,13 +52,13 @@ const PERMITTED_UPDATE_OPERATIONS = [
5252] as const ;
5353
5454interface StabilityData {
55- userStability : number ;
56- sessionStability : number ;
57- stabilityTargetType : string ;
58- targetStability : number ;
59- criticalStability : number ;
60- meetsTargetStability : boolean ;
61- meetsCriticalStability : boolean ;
55+ user_stability : number ;
56+ session_stability : number ;
57+ stability_target_type : string ;
58+ target_stability : number ;
59+ critical_stability : number ;
60+ meets_target_stability : boolean ;
61+ meets_critical_stability : boolean ;
6262}
6363
6464const ConfigurationSchema = z . object ( {
@@ -135,7 +135,7 @@ export class BugsnagClient implements Client {
135135 const projects = await this . getProjects ( ) ;
136136 // If there's just one project, make this the current project
137137 if ( projects . length === 1 && ! this . projectApiKey ) {
138- this . projectApiKey = projects [ 0 ] . apiKey ;
138+ this . projectApiKey = projects [ 0 ] . api_key ;
139139 }
140140 } catch ( error ) {
141141 // Swallow auth errors here to allow the tools to be registered for visibility, even if the token is invalid
@@ -263,7 +263,7 @@ export class BugsnagClient implements Client {
263263 if ( ! project && this . projectApiKey ) {
264264 const projects = await this . getProjects ( ) ;
265265 project =
266- projects . find ( ( p : Project ) => p . apiKey === this . projectApiKey ) ?? null ;
266+ projects . find ( ( p : Project ) => p . api_key === this . projectApiKey ) ?? null ;
267267 this . cache ?. set ( cacheKeys . CURRENT_PROJECT , project ) ;
268268 }
269269 return project ;
@@ -285,7 +285,7 @@ export class BugsnagClient implements Client {
285285 }
286286 filtersResponse = filtersResponse . filter (
287287 ( field ) =>
288- field . displayId && ! EXCLUDED_EVENT_FIELDS . has ( field . displayId ) ,
288+ field . display_id && ! EXCLUDED_EVENT_FIELDS . has ( field . display_id ) ,
289289 ) ;
290290 projectFiltersCache [ project . id ] = filtersResponse ;
291291 this . cache ?. set ( cacheKeys . PROJECT_EVENT_FIELDS , projectFiltersCache ) ;
@@ -353,42 +353,45 @@ export class BugsnagClient implements Client {
353353 source : T ,
354354 project : Project ,
355355 ) : T & StabilityData {
356- const accumulativeDailyUsersSeen = source . accumulativeDailyUsersSeen || 0 ;
356+ const accumulativeDailyUsersSeen =
357+ source . accumulative_daily_users_seen || 0 ;
357358 const accumulativeDailyUsersWithUnhandled =
358- source . accumulativeDailyUsersWithUnhandled || 0 ;
359+ source . accumulative_daily_users_with_unhandled || 0 ;
359360
360361 const userStability =
361362 accumulativeDailyUsersSeen === 0 // avoid division by zero
362363 ? 0
363364 : ( accumulativeDailyUsersSeen - accumulativeDailyUsersWithUnhandled ) /
364365 accumulativeDailyUsersSeen ;
365366
366- const totalSessionsCount = source . totalSessionsCount || 0 ;
367- const unhandledSessionsCount = source . unhandledSessionsCount || 0 ;
367+ const totalSessionsCount = source . total_sessions_count || 0 ;
368+ const unhandledSessionsCount = source . unhandled_sessions_count || 0 ;
368369
369370 const sessionStability =
370371 totalSessionsCount === 0 // avoid division by zero
371372 ? 0
372373 : ( totalSessionsCount - unhandledSessionsCount ) / totalSessionsCount ;
373374
374375 const stabilityMetric =
375- project . stabilityTargetType === "user" ? userStability : sessionStability ;
376+ project . stability_target_type === "user"
377+ ? userStability
378+ : sessionStability ;
376379
377- const targetStability = project . targetStability ?. value || 0 ;
378- const criticalStability = project . criticalStability ?. value || 0 ;
380+ const targetStability = project . target_stability ?. value || 0 ;
381+ const criticalStability = project . critical_stability ?. value || 0 ;
379382
380383 const meetsTargetStability = stabilityMetric >= targetStability ;
381384 const meetsCriticalStability = stabilityMetric >= criticalStability ;
382385
383386 return {
384387 ...source ,
385- userStability,
386- sessionStability,
387- stabilityTargetType : project . stabilityTargetType || "user" ,
388- targetStability,
389- criticalStability,
390- meetsTargetStability,
391- meetsCriticalStability,
388+ user_stability : userStability ,
389+ session_stability : sessionStability ,
390+ stability_target_type : project . stability_target_type || "user" ,
391+ target_stability : targetStability ,
392+ critical_stability : criticalStability ,
393+ meets_target_stability : meetsTargetStability ,
394+ meets_critical_stability : meetsCriticalStability ,
392395 } ;
393396 }
394397
@@ -458,7 +461,7 @@ export class BugsnagClient implements Client {
458461 }
459462 if ( params . apiKey ) {
460463 const matchedProject = projects . find (
461- ( p : Project ) => p . apiKey === params . apiKey ,
464+ ( p : Project ) => p . api_key === params . apiKey ,
462465 ) ;
463466 projects = matchedProject ? [ matchedProject ] : [ ] ;
464467 }
@@ -727,7 +730,7 @@ export class BugsnagClient implements Client {
727730 // Validate filter keys against cached event fields
728731 if ( params . filters ) {
729732 const eventFields = await this . getProjectEventFields ( project ) ;
730- const validKeys = new Set ( eventFields . map ( ( f ) => f . displayId ) ) ;
733+ const validKeys = new Set ( eventFields . map ( ( f ) => f . display_id ) ) ;
731734 for ( const key of Object . keys ( params . filters ) ) {
732735 if ( ! validKeys . has ( key ) ) {
733736 throw new ToolError ( `Invalid filter key: ${ key } ` ) ;
0 commit comments