@awsesh/core 1.0.0-beta.202601241326 → 1.0.0-beta.202601241355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +4 -0
- package/index.js +3 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -62,11 +62,13 @@ export declare function createAwsesh(options: AwseshOptions): {
|
|
|
62
62
|
save: (sessionName: string, accountId: string, region: string) => Promise<void>;
|
|
63
63
|
getAll: (sessionName: string) => Promise<Record<string, string>>;
|
|
64
64
|
};
|
|
65
|
+
/** @internal Low-level primitive. Prefer `setCredential()` for most use cases. */
|
|
65
66
|
credentials: {
|
|
66
67
|
write: (profileName: string, creds: RoleCredentials, region?: string) => Promise<void>;
|
|
67
68
|
removeProfile: (profileName: string) => Promise<void>;
|
|
68
69
|
listProfiles: () => Promise<string[]>;
|
|
69
70
|
};
|
|
71
|
+
/** @internal Low-level primitive. Prefer `setCredential()` / `clearCredential()` for most use cases. */
|
|
70
72
|
activeCredentials: {
|
|
71
73
|
list: () => Promise<ActiveCredential[]>;
|
|
72
74
|
save: (credential: ActiveCredential) => Promise<void>;
|
|
@@ -74,6 +76,7 @@ export declare function createAwsesh(options: AwseshOptions): {
|
|
|
74
76
|
cleanup: () => Promise<void>;
|
|
75
77
|
remove: (accountId: string, roleName: string) => Promise<void>;
|
|
76
78
|
};
|
|
79
|
+
/** @internal Low-level primitive. Prefer `setCredential()` / `clearCredential()` for most use cases. */
|
|
77
80
|
lastSetCredential: {
|
|
78
81
|
get: () => Promise<LastSetCredential | undefined>;
|
|
79
82
|
save: (credential: LastSetCredential) => Promise<void>;
|
|
@@ -82,6 +85,7 @@ export declare function createAwsesh(options: AwseshOptions): {
|
|
|
82
85
|
/**
|
|
83
86
|
* High-level API: Set credentials with all tracking automatically handled.
|
|
84
87
|
* Writes to ~/.aws/credentials, updates activeCredentials, lastSetCredential, and lastSelected.
|
|
88
|
+
* If no profileName is provided, looks up the configured profile for this session/account/role.
|
|
85
89
|
*/
|
|
86
90
|
setCredential(options: SetCredentialOptions): Promise<SetCredentialResult>;
|
|
87
91
|
/**
|
package/index.js
CHANGED
|
@@ -20471,8 +20471,9 @@ function createAwsesh(options) {
|
|
|
20471
20471
|
region,
|
|
20472
20472
|
profileName: customProfileName
|
|
20473
20473
|
} = options2;
|
|
20474
|
-
const
|
|
20475
|
-
const
|
|
20474
|
+
const configuredProfile = customProfileName === undefined ? await storage.read("preference/profile-names").then((data) => data?.[sessionName]?.[accountName]?.[roleName]) : undefined;
|
|
20475
|
+
const profileName = customProfileName || configuredProfile || "default";
|
|
20476
|
+
const isDefault = !customProfileName && !configuredProfile;
|
|
20476
20477
|
await Credentials.write({
|
|
20477
20478
|
awsDir,
|
|
20478
20479
|
profileName,
|