@gugananuvem/aws-local-simulator 1.0.31 → 1.0.33

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.31",
3
+ "version": "1.0.33",
4
4
  "description": "Simulador local completo para serviços AWS",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -66,6 +66,6 @@
66
66
  "publishConfig": {
67
67
  "directory": "dist"
68
68
  },
69
- "buildDate": "2026-05-05T10:06:53.890Z",
69
+ "buildDate": "2026-05-07T01:08:47.293Z",
70
70
  "published": true
71
71
  }
@@ -268,8 +268,8 @@ class CognitoSimulator {
268
268
  Username: u.Username,
269
269
  UserStatus: u.UserStatus,
270
270
  Enabled: u.Enabled,
271
- UserCreateDate: u.CreatedDate,
272
- UserLastModifiedDate: u.LastModifiedDate,
271
+ UserCreateDate: new Date(u.CreatedDate).getTime() / 1000,
272
+ UserLastModifiedDate: new Date(u.LastModifiedDate).getTime() / 1000,
273
273
  Attributes: this._formatUserAttributesWithSub(u),
274
274
  })),
275
275
  PaginationToken: nextToken,
@@ -1204,8 +1204,8 @@ class CognitoSimulator {
1204
1204
  return {
1205
1205
  Username: user.Username,
1206
1206
  UserAttributes: this._formatUserAttributesWithSub(user),
1207
- UserCreateDate: user.CreatedDate,
1208
- UserLastModifiedDate: user.LastModifiedDate,
1207
+ UserCreateDate: new Date(user.CreatedDate).getTime() / 1000,
1208
+ UserLastModifiedDate: new Date(user.LastModifiedDate).getTime() / 1000,
1209
1209
  Enabled: user.Enabled,
1210
1210
  UserStatus: user.UserStatus,
1211
1211
  MFAOptions: user.MfaOptions,
@@ -1279,12 +1279,12 @@ class CognitoSimulator {
1279
1279
  return {
1280
1280
  User: {
1281
1281
  Username: user.Username,
1282
- UserAttributes: this._formatUserAttributesWithSub(user),
1283
- UserCreateDate: user.CreatedDate,
1284
- UserLastModifiedDate: user.LastModifiedDate,
1282
+ Attributes: this._formatUserAttributesWithSub(user),
1283
+ UserCreateDate: new Date(user.CreatedDate).getTime() / 1000,
1284
+ UserLastModifiedDate: new Date(user.LastModifiedDate).getTime() / 1000,
1285
1285
  Enabled: user.Enabled,
1286
1286
  UserStatus: user.UserStatus,
1287
- TemporaryPassword: tempPassword,
1287
+ MFAOptions: user.MfaOptions || [],
1288
1288
  },
1289
1289
  };
1290
1290
  }
@@ -1506,7 +1506,7 @@ class CognitoSimulator {
1506
1506
  AccessKeyId: `AKIA${crypto.randomBytes(16).toString("hex").toUpperCase()}`,
1507
1507
  SecretKey: crypto.randomBytes(32).toString("hex"),
1508
1508
  SessionToken: crypto.randomBytes(64).toString("base64"),
1509
- Expiration: new Date(Date.now() + 3600000).toISOString(),
1509
+ Expiration: new Date(Date.now() + 3600000),
1510
1510
  };
1511
1511
 
1512
1512
  return {
@@ -602,7 +602,19 @@ class DynamoDBSimulator {
602
602
  if (KeyConditionExpression) {
603
603
  const parts = KeyConditionExpression.split(/\s+AND\s+/i);
604
604
  for (const part of parts) {
605
- const match = part.match(/([^\s]+)\s*(=|>|<|>=|<=|BEGINS_WITH|BETWEEN)\s*([^\s]+)(?:\s+AND\s+([^\s]+))?/i);
605
+ const trimmedPart = part.trim();
606
+
607
+ // Tenta match de função: begins_with(attr, :val)
608
+ const funcMatch = trimmedPart.match(/^begins_with\s*\(\s*([^\s,]+)\s*,\s*([^\s,)]+)\s*\)$/i);
609
+ if (funcMatch) {
610
+ const attributeName = resolveAttributeName(funcMatch[1]);
611
+ const expectedValue = resolveValue(funcMatch[2]);
612
+ items = items.filter(item => String(item[attributeName] || "").startsWith(String(expectedValue)));
613
+ continue;
614
+ }
615
+
616
+ // Tenta match de operador infix: attr OP :val
617
+ const match = trimmedPart.match(/([^\s]+)\s*(=|>|<|>=|<=|BEGINS_WITH|BETWEEN)\s*([^\s]+)(?:\s+AND\s+([^\s]+))?/i);
606
618
  if (match) {
607
619
  const attrPlaceholder = match[1];
608
620
  const operator = match[2].toUpperCase();