@@ -144,48 +144,60 @@ export const showSsoSignIn = Commands.declare('aws.codeWhisperer.sso', () => asy
144
144
// Shortcut command to directly connect to Identity Center or prompt start URL entry
145
145
// It can optionally set a customization too based on given values to match on
146
146
export const connectWithCustomization = Commands . declare (
147
- 'aws.codeWhisperer.connect' ,
148
- ( ) => async ( startUrl ?: string , region ?: string , customizationArn ?: string , customizationNamePrefix ?: string ) => {
149
- // This command supports the following arguments:
150
- // * startUrl and region. If both arguments are provided they will be used, otherwise
151
- // the command prompts for them interactively.
152
- // * customizationArn: select customization by ARN. If provided, `customizationNamePrefix` is ignored.
153
- // * customizationNamePrefix: select customization by prefix, if `customizationArn` is `undefined`.
154
- if ( startUrl && region ) {
155
- await connectToEnterpriseSso ( startUrl , region )
156
- } else {
157
- await getStartUrl ( )
158
- }
147
+ { id : 'aws.codeWhisperer.connect' , compositeKey : { 0 : 'source' } } ,
148
+ /**
149
+ * This command supports the following arguments:
150
+ * @param source - an identifier for who used this command. This value is not explicitly used in the function, but is used elsewhere.
151
+ * startUrl and region. If both arguments are provided they will be used, otherwise
152
+ * the command prompts for them interactively.
153
+ * customizationArn: select customization by ARN. If provided, `customizationNamePrefix` is ignored.
154
+ * customizationNamePrefix: select customization by prefix, if `customizationArn` is `undefined`.
155
+ */
156
+ ( ) =>
157
+ async (
158
+ source : string ,
159
+ startUrl ?: string ,
160
+ region ?: string ,
161
+ customizationArn ?: string ,
162
+ customizationNamePrefix ?: string
163
+ ) => {
164
+ if ( startUrl && region ) {
165
+ await connectToEnterpriseSso ( startUrl , region )
166
+ } else {
167
+ await getStartUrl ( )
168
+ }
159
169
160
- // No customization match information given, exit early.
161
- if ( ! customizationArn && ! customizationNamePrefix ) {
162
- return
163
- }
170
+ // No customization match information given, exit early.
171
+ if ( ! customizationArn && ! customizationNamePrefix ) {
172
+ return
173
+ }
164
174
165
- let persistedCustomizations = getPersistedCustomizations ( )
175
+ let persistedCustomizations = getPersistedCustomizations ( )
166
176
167
- // Check if any customizations have already been persisted.
168
- // If not, call `notifyNewCustomizations` to handle it then recheck.
169
- if ( persistedCustomizations . length === 0 ) {
170
- await notifyNewCustomizations ( )
171
- persistedCustomizations = getPersistedCustomizations ( )
172
- }
177
+ // Check if any customizations have already been persisted.
178
+ // If not, call `notifyNewCustomizations` to handle it then recheck.
179
+ if ( persistedCustomizations . length === 0 ) {
180
+ await notifyNewCustomizations ( )
181
+ persistedCustomizations = getPersistedCustomizations ( )
182
+ }
173
183
174
- // If given an ARN, assume a specific customization is desired and find an entry that matches it. Ignores the prefix logic.
175
- // Otherwise if only a prefix is given, find an entry that matches it.
176
- // Backwards compatible with previous implementation.
177
- const match = customizationArn
178
- ? persistedCustomizations . find ( c => c . arn === customizationArn )
179
- : persistedCustomizations . find ( c => c . name ?. startsWith ( customizationNamePrefix as string ) )
184
+ // If given an ARN, assume a specific customization is desired and find an entry that matches it. Ignores the prefix logic.
185
+ // Otherwise if only a prefix is given, find an entry that matches it.
186
+ // Backwards compatible with previous implementation.
187
+ const match = customizationArn
188
+ ? persistedCustomizations . find ( c => c . arn === customizationArn )
189
+ : persistedCustomizations . find ( c => c . name ?. startsWith ( customizationNamePrefix as string ) )
180
190
181
- // If no match is found, nothing to do :)
182
- if ( ! match ) {
183
- getLogger ( ) . error ( `No customization match found: arn=${ customizationArn } prefix=${ customizationNamePrefix } ` )
184
- return
191
+ // If no match is found, nothing to do :)
192
+ if ( ! match ) {
193
+ getLogger ( ) . error (
194
+ `No customization match found: arn=${ customizationArn } prefix=${ customizationNamePrefix } `
195
+ )
196
+ return
197
+ }
198
+ // Since we selected based on a match, we'll reuse the persisted values.
199
+ await selectCustomization ( match )
185
200
}
186
- // Since we selected based on a match, we'll reuse the persisted values.
187
- await selectCustomization ( match )
188
- }
189
201
)
190
202
191
203
export const showLearnMore = Commands . declare (
0 commit comments