@gugananuvem/aws-local-simulator 1.0.18 → 1.0.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gugananuvem/aws-local-simulator",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Simulador local completo para serviços AWS",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -120,6 +120,6 @@
120
120
  "optional": true
121
121
  }
122
122
  },
123
- "buildDate": "2026-04-21T01:06:51.838Z",
123
+ "buildDate": "2026-04-22T01:57:09.515Z",
124
124
  "published": true
125
125
  }
@@ -223,7 +223,7 @@ class CognitoSimulator {
223
223
  Enabled: u.Enabled,
224
224
  UserCreateDate: u.CreatedDate,
225
225
  UserLastModifiedDate: u.LastModifiedDate,
226
- Attributes: this.formatUserAttributes(u.Attributes),
226
+ Attributes: this._formatUserAttributesWithSub(u),
227
227
  })),
228
228
  PaginationToken: nextToken,
229
229
  };
@@ -570,9 +570,10 @@ class CognitoSimulator {
570
570
  if (!this.sessions.has(session.Id)) throw new Error("Token has been revoked");
571
571
  const user = this.users.get(session.UserId);
572
572
  if (!user) throw new Error("User not found");
573
+ const attributes = this._formatUserAttributesWithSub(user);
573
574
  return {
574
575
  Username: user.Username,
575
- UserAttributes: this.formatUserAttributes(user.Attributes),
576
+ UserAttributes: attributes,
576
577
  UserStatus: user.UserStatus,
577
578
  };
578
579
  }
@@ -1155,7 +1156,7 @@ class CognitoSimulator {
1155
1156
 
1156
1157
  return {
1157
1158
  Username: user.Username,
1158
- UserAttributes: this.formatUserAttributes(user.Attributes),
1159
+ UserAttributes: this._formatUserAttributesWithSub(user),
1159
1160
  UserCreateDate: user.CreatedDate,
1160
1161
  UserLastModifiedDate: user.LastModifiedDate,
1161
1162
  Enabled: user.Enabled,
@@ -1214,7 +1215,7 @@ class CognitoSimulator {
1214
1215
  return {
1215
1216
  User: {
1216
1217
  Username: user.Username,
1217
- UserAttributes: this.formatUserAttributes(user.Attributes),
1218
+ UserAttributes: this._formatUserAttributesWithSub(user),
1218
1219
  UserCreateDate: user.CreatedDate,
1219
1220
  UserLastModifiedDate: user.LastModifiedDate,
1220
1221
  Enabled: user.Enabled,
@@ -1321,6 +1322,14 @@ class CognitoSimulator {
1321
1322
  return Object.entries(attributes).map(([Name, Value]) => ({ Name, Value }));
1322
1323
  }
1323
1324
 
1325
+ _formatUserAttributesWithSub(user) {
1326
+ const attrs = this.formatUserAttributes(user.Attributes);
1327
+ if (!attrs.find(a => a.Name === 'sub')) {
1328
+ attrs.unshift({ Name: 'sub', Value: user.UserId });
1329
+ }
1330
+ return attrs;
1331
+ }
1332
+
1324
1333
  hashPassword(password) {
1325
1334
  // Simulação de hash (não usar em produção real)
1326
1335
  return crypto.createHash("sha256").update(password).digest("hex");