@awsesh/core 1.0.0-alpha.202512230821 → 1.0.0-alpha.202512231130

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.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +21 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -39,6 +39,7 @@ export declare function createAwsesh(options: AwseshOptions): {
39
39
  get: (sessionName: string, accountName: string, roleName: string) => Promise<string | undefined>;
40
40
  save: (sessionName: string, accountName: string, roleName: string, profileName: string) => Promise<void>;
41
41
  getForAccount: (sessionName: string, accountName: string) => Promise<Record<string, string>>;
42
+ remove: (sessionName: string, accountName: string, roleName: string) => Promise<void>;
42
43
  };
43
44
  preferredRoles: {
44
45
  get: (sessionName: string, accountId: string) => Promise<string | undefined>;
@@ -53,6 +54,7 @@ export declare function createAwsesh(options: AwseshOptions): {
53
54
  save: (credential: ActiveCredential) => Promise<void>;
54
55
  getForAccount: (accountId: string) => Promise<ActiveCredential[]>;
55
56
  cleanup: () => Promise<void>;
57
+ remove: (accountId: string, roleName: string) => Promise<void>;
56
58
  };
57
59
  };
58
60
  export type Awsesh = ReturnType<typeof createAwsesh>;
package/index.js CHANGED
@@ -20260,6 +20260,20 @@ function createAwsesh(options) {
20260
20260
  getForAccount: async (sessionName, accountName) => {
20261
20261
  const data = await storage.read("preference/profile-names");
20262
20262
  return data?.[sessionName]?.[accountName] ?? {};
20263
+ },
20264
+ remove: async (sessionName, accountName, roleName) => {
20265
+ await storage.update("preference/profile-names", (draft) => {
20266
+ if (draft[sessionName]?.[accountName]?.[roleName]) {
20267
+ delete draft[sessionName][accountName][roleName];
20268
+ if (Object.keys(draft[sessionName][accountName]).length === 0) {
20269
+ delete draft[sessionName][accountName];
20270
+ }
20271
+ if (Object.keys(draft[sessionName]).length === 0) {
20272
+ delete draft[sessionName];
20273
+ }
20274
+ }
20275
+ return draft;
20276
+ });
20263
20277
  }
20264
20278
  },
20265
20279
  preferredRoles: {
@@ -20320,6 +20334,13 @@ function createAwsesh(options) {
20320
20334
  const now = new Date;
20321
20335
  return existing.filter((c) => new Date(c.expiration) > now);
20322
20336
  });
20337
+ },
20338
+ remove: async (accountId, roleName) => {
20339
+ await storage.update("credentials/active", (existing) => {
20340
+ if (!existing || !Array.isArray(existing))
20341
+ return [];
20342
+ return existing.filter((c) => !(c.accountId === accountId && c.roleName === roleName));
20343
+ });
20323
20344
  }
20324
20345
  }
20325
20346
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsesh/core",
3
- "version": "1.0.0-alpha.202512230821",
3
+ "version": "1.0.0-alpha.202512231130",
4
4
  "description": "AWS SSO session management SDK",
5
5
  "type": "module",
6
6
  "main": "./index.js",