@@ -9,6 +9,8 @@ const root = path.join(__dirname, "..", "..");
99
1010const models = path . join ( root , "codegen" , "sdk-codegen" , "aws-models" ) ;
1111
12+ const protocolCounts = { } ;
13+
1214for ( const file of fs . readdirSync ( models ) ) {
1315 if ( file . endsWith ( ".json" ) ) {
1416 const model = require ( path . join ( models , file ) ) ;
@@ -17,7 +19,12 @@ for (const file of fs.readdirSync(models)) {
1719 const operations = Object . entries ( shapes ) . filter ( ( [ id , s ] ) => {
1820 return s . type === "operation" ;
1921 } ) ;
20- const protocol = Object . entries ( service [ 1 ] . traits ) . find ( ( [ id , trait ] ) => id . startsWith ( "aws.protocol" ) ) [ 0 ] ;
22+ const protocol = Object . entries ( service [ 1 ] . traits ) . find (
23+ ( [ id , trait ] ) => id . startsWith ( "aws.protocol" ) || id . startsWith ( "smithy.protocol" )
24+ ) [ 0 ] ;
25+
26+ protocolCounts [ protocol ] = protocolCounts [ protocol ] ?? { } ;
27+ protocolCounts [ protocol ] [ service [ 0 ] ] = operations . length ;
2128
2229 if ( protocol . includes ( "rest" ) ) {
2330 const inputOutputShapes = Object . entries ( shapes ) . filter ( ( [ id , s ] ) => {
@@ -129,3 +136,15 @@ for (const file of fs.readdirSync(models)) {
129136 }
130137 }
131138}
139+
140+ for ( const [ protocol , serviceToOperationCounts ] of Object . entries ( protocolCounts ) ) {
141+ const entries = Object . entries ( serviceToOperationCounts ) . sort ( ( [ s1 , c1 ] , [ s2 , c2 ] ) => {
142+ return c2 - c1 ;
143+ } ) ;
144+ for ( const [ s , c ] of entries ) {
145+ delete serviceToOperationCounts [ s ] ;
146+ serviceToOperationCounts [ s ] = c ;
147+ }
148+ }
149+
150+ console . log ( protocolCounts ) ;
0 commit comments