@@ -18,6 +18,7 @@ export class SdkClientTocPlugin extends RendererComponent {
18
18
private commandsNavigationItem ?: NavigationItem ;
19
19
private clientsNavigationItem ?: NavigationItem ;
20
20
private paginatorsNavigationItem ?: NavigationItem ;
21
+ private waitersNavigationItem ?: NavigationItem ;
21
22
private clientDir ?: string ;
22
23
23
24
initialize ( ) {
@@ -53,11 +54,17 @@ export class SdkClientTocPlugin extends RendererComponent {
53
54
this . clientsNavigationItem = new NavigationItem ( "Clients" , void 0 , page . toc ) ;
54
55
this . commandsNavigationItem = new NavigationItem ( "Commands" , void 0 , page . toc ) ;
55
56
this . paginatorsNavigationItem = new NavigationItem ( "Paginators" , void 0 , page . toc ) ;
57
+ this . waitersNavigationItem = new NavigationItem ( "Waiters" , void 0 , page . toc ) ;
56
58
}
57
59
58
60
this . buildToc ( model , trail , page . toc , tocRestriction ) ;
59
61
}
60
62
63
+ // Confirm declaration comes from the same folder as the client class
64
+ private belongsToClientPackage ( model : DeclarationReflection ) : boolean {
65
+ return this . clientDir && model . sources ?. [ 0 ] . file ?. fullFileName . indexOf ( this . clientDir ) === 0 ;
66
+ }
67
+
61
68
private isClient ( model : DeclarationReflection ) : boolean {
62
69
const { extendedTypes = [ ] } = model ;
63
70
return (
@@ -66,28 +73,36 @@ export class SdkClientTocPlugin extends RendererComponent {
66
73
( model . name . endsWith ( "Client" ) /* Modular client like S3Client */ ||
67
74
extendedTypes . filter ( ( reference ) => ( reference as ReferenceType ) . name === `${ model . name } Client` ) . length > 0 ) &&
68
75
/* Filter out other client classes that not sourced from the same directory as current client. e.g. STS, SSO */
69
- this . clientDir &&
70
- dirname ( model . sources [ 0 ] ?. file . fullFileName ) === this . clientDir
76
+ this . belongsToClientPackage ( model )
71
77
) ;
72
78
}
73
79
74
80
private isCommand ( model : DeclarationReflection ) : boolean {
75
81
return (
76
82
model . kindOf ( ReflectionKind . Class ) &&
77
- model . getFullName ( ) !== "Command" && // Exclude the Smithy Command class.
78
83
model . name . endsWith ( "Command" ) &&
79
- model . children ?. some ( ( child ) => child . name === "resolveMiddleware" )
84
+ model . children ?. some ( ( child ) => child . name === "resolveMiddleware" ) &&
85
+ this . belongsToClientPackage ( model )
80
86
) ;
81
87
}
82
88
83
89
private isPaginator ( model : DeclarationReflection ) : boolean {
84
- return model . name . startsWith ( "paginate" ) && model . kindOf ( ReflectionKind . Function ) ;
90
+ return (
91
+ model . name . startsWith ( "paginate" ) && model . kindOf ( ReflectionKind . Function ) && this . belongsToClientPackage ( model )
92
+ ) ;
85
93
}
86
94
87
95
private isInputOrOutput ( model : DeclarationReflection ) : boolean {
88
96
return (
89
97
model . kindOf ( ReflectionKind . Interface ) &&
90
- ( model . name . endsWith ( "CommandInput" ) || model . name . endsWith ( "CommandOutput" ) )
98
+ ( model . name . endsWith ( "CommandInput" ) || model . name . endsWith ( "CommandOutput" ) ) &&
99
+ this . belongsToClientPackage ( model )
100
+ ) ;
101
+ }
102
+
103
+ private isWaiter ( model : DeclarationReflection ) : boolean {
104
+ return (
105
+ model . name . startsWith ( "waitFor" ) && model . kindOf ( ReflectionKind . Function ) && this . belongsToClientPackage ( model )
91
106
) ;
92
107
}
93
108
@@ -128,6 +143,8 @@ export class SdkClientTocPlugin extends RendererComponent {
128
143
NavigationItem . create ( child , this . paginatorsNavigationItem , true ) ;
129
144
} else if ( this . isInputOrOutput ( child ) ) {
130
145
NavigationItem . create ( child , this . commandsNavigationItem , true ) ;
146
+ } else if ( this . isWaiter ( child ) ) {
147
+ NavigationItem . create ( child , this . waitersNavigationItem , true ) ;
131
148
} else {
132
149
const item = NavigationItem . create ( child , parent , true ) ;
133
150
if ( trail . includes ( child ) ) {
0 commit comments