@@ -3,7 +3,6 @@ import { AblyBaseCommand } from "../../base-command.js";
33import { productApiFlags } from "../../flags.js" ;
44import {
55 formatCountLabel ,
6- formatLabel ,
76 formatLimitWarning ,
87 formatResource ,
98} from "../../utils/output.js" ;
@@ -13,23 +12,9 @@ import {
1312 formatPaginationLog ,
1413} from "../../utils/pagination.js" ;
1514
16- interface ChannelMetrics {
17- connections ?: number ;
18- presenceConnections ?: number ;
19- presenceMembers ?: number ;
20- publishers ?: number ;
21- subscribers ?: number ;
22- }
23-
24- interface ChannelStatus {
25- occupancy ?: {
26- metrics ?: ChannelMetrics ;
27- } ;
28- }
29-
3015interface ChannelItem {
3116 channelId : string ;
32- status ?: ChannelStatus ;
17+ [ key : string ] : unknown ;
3318}
3419
3520// Type for channel listing request parameters
@@ -123,7 +108,6 @@ export default class ChannelsList extends AblyBaseCommand {
123108 {
124109 channels : channels . map ( ( channel : ChannelItem ) => ( {
125110 channelId : channel . channelId ,
126- metrics : channel . status ?. occupancy ?. metrics || { } ,
127111 } ) ) ,
128112 hasMore,
129113 ...( next && { next } ) ,
@@ -139,39 +123,11 @@ export default class ChannelsList extends AblyBaseCommand {
139123 }
140124
141125 this . log (
142- `Found ${ formatCountLabel ( channels . length , "active channel" ) } :` ,
126+ `Found ${ formatCountLabel ( channels . length , "active channel" ) } :\n ` ,
143127 ) ;
144128
145129 for ( const channel of channels ) {
146130 this . log ( `${ formatResource ( channel . channelId ) } ` ) ;
147-
148- // Show occupancy if available
149- if ( channel . status ?. occupancy ?. metrics ) {
150- const { metrics } = channel . status . occupancy ;
151- this . log (
152- ` ${ formatLabel ( "Connections" ) } ${ metrics . connections || 0 } ` ,
153- ) ;
154- this . log (
155- ` ${ formatLabel ( "Publishers" ) } ${ metrics . publishers || 0 } ` ,
156- ) ;
157- this . log (
158- ` ${ formatLabel ( "Subscribers" ) } ${ metrics . subscribers || 0 } ` ,
159- ) ;
160-
161- if ( metrics . presenceConnections !== undefined ) {
162- this . log (
163- ` ${ formatLabel ( "Presence Connections" ) } ${ metrics . presenceConnections } ` ,
164- ) ;
165- }
166-
167- if ( metrics . presenceMembers !== undefined ) {
168- this . log (
169- ` ${ formatLabel ( "Presence Members" ) } ${ metrics . presenceMembers } ` ,
170- ) ;
171- }
172- }
173-
174- this . log ( "" ) ; // Add a line break between channels
175131 }
176132
177133 if ( hasMore ) {
@@ -180,7 +136,7 @@ export default class ChannelsList extends AblyBaseCommand {
180136 flags . limit ,
181137 "channels" ,
182138 ) ;
183- if ( warning ) this . log ( warning ) ;
139+ if ( warning ) this . log ( `\n ${ warning } ` ) ;
184140 }
185141 }
186142 } catch ( error ) {
0 commit comments