Skip to content

Commit 5c30945

Browse files
fix: address feedbacks
Co-authored-by: Trivikram Kamat <[email protected]>
1 parent 02b8f57 commit 5c30945

File tree

1 file changed

+8
-10
lines changed
  • packages/credential-provider-ini/src

1 file changed

+8
-10
lines changed

packages/credential-provider-ini/src/index.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,23 @@ interface AssumeRoleWithProviderProfile extends Profile {
128128
credential_source: string;
129129
}
130130

131-
const isAssumeRoleWithSourceProfile = (arg: any): arg is AssumeRoleWithSourceProfile =>
131+
const isAssumeRoleProfile = (arg: any) =>
132132
Boolean(arg) &&
133133
typeof arg === "object" &&
134134
typeof arg.role_arn === "string" &&
135-
typeof arg.source_profile === "string" &&
136-
typeof arg.credential_source === "undefined" &&
137135
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
138136
["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
139137
["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1;
140138

139+
const isAssumeRoleWithSourceProfile = (arg: any): arg is AssumeRoleWithSourceProfile =>
140+
isAssumeRoleProfile(arg) &&
141+
typeof arg.source_profile === "string" &&
142+
typeof arg.credential_source === "undefined";
143+
141144
const isAssumeRoleWithProviderProfile = (arg: any): arg is AssumeRoleWithProviderProfile =>
142-
Boolean(arg) &&
143-
typeof arg === "object" &&
144-
typeof arg.role_arn === "string" &&
145+
isAssumeRoleProfile(arg) &&
145146
typeof arg.credential_source === "string" &&
146-
typeof arg.source_profile === "undefined" &&
147-
["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 &&
148-
["undefined", "string"].indexOf(typeof arg.external_id) > -1 &&
149-
["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1;
147+
typeof arg.source_profile === "undefined";
150148

151149
/**
152150
* Creates a credential provider that will read from ini files and supports

0 commit comments

Comments
 (0)