@gugananuvem/aws-local-simulator 1.0.21 → 1.0.22
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.
|
|
3
|
+
"version": "1.0.22",
|
|
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-
|
|
123
|
+
"buildDate": "2026-04-22T18:03:41.660Z",
|
|
124
124
|
"published": true
|
|
125
125
|
}
|
|
@@ -37,11 +37,38 @@ class DynamoDBSimulator {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
// Cria tabelas da configuração
|
|
40
|
+
// Cria tabelas da configuração ou atualiza schema (GSIs/attributeTypes) se já existirem
|
|
41
41
|
if (this.config.dynamodb?.tables) {
|
|
42
42
|
for (const tableDef of this.config.dynamodb.tables) {
|
|
43
|
-
|
|
43
|
+
const { TableName, AttributeDefinitions, GlobalSecondaryIndexes } = tableDef;
|
|
44
|
+
if (this.tables.has(TableName)) {
|
|
45
|
+
// Tabela já existe no disco — atualiza schema sem apagar dados
|
|
46
|
+
const existing = this.tables.get(TableName);
|
|
47
|
+
|
|
48
|
+
if (AttributeDefinitions) {
|
|
49
|
+
const attributeTypes = {};
|
|
50
|
+
AttributeDefinitions.forEach((attr) => {
|
|
51
|
+
attributeTypes[attr.AttributeName] = attr.AttributeType;
|
|
52
|
+
});
|
|
53
|
+
existing.attributeTypes = attributeTypes;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (GlobalSecondaryIndexes) {
|
|
57
|
+
const globalSecondaryIndexes = {};
|
|
58
|
+
for (const gsi of GlobalSecondaryIndexes) {
|
|
59
|
+
const gsiHashKey = gsi.KeySchema.find((k) => k.KeyType === "HASH").AttributeName;
|
|
60
|
+
const gsiRangeKey = gsi.KeySchema.find((k) => k.KeyType === "RANGE")?.AttributeName;
|
|
61
|
+
globalSecondaryIndexes[gsi.IndexName] = { hashKey: gsiHashKey, rangeKey: gsiRangeKey };
|
|
62
|
+
}
|
|
63
|
+
existing.globalSecondaryIndexes = globalSecondaryIndexes;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.tables.set(TableName, existing);
|
|
67
|
+
} else {
|
|
68
|
+
this.createTable(tableDef);
|
|
69
|
+
}
|
|
44
70
|
}
|
|
71
|
+
this.persistTables();
|
|
45
72
|
}
|
|
46
73
|
}
|
|
47
74
|
|