@gugananuvem/aws-local-simulator 1.0.9 → 1.0.11

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 (41) hide show
  1. package/README.md +204 -192
  2. package/bin/aws-local-simulator.js +62 -62
  3. package/package.json +2 -2
  4. package/src/config/config-loader.js +112 -112
  5. package/src/config/default-config.js +65 -65
  6. package/src/config/env-loader.js +68 -66
  7. package/src/index.js +130 -130
  8. package/src/index.mjs +123 -123
  9. package/src/server.js +221 -219
  10. package/src/services/apigateway/index.js +66 -66
  11. package/src/services/apigateway/server.js +434 -434
  12. package/src/services/apigateway/simulator.js +1251 -1251
  13. package/src/services/cognito/index.js +65 -65
  14. package/src/services/cognito/server.js +228 -228
  15. package/src/services/cognito/simulator.js +847 -847
  16. package/src/services/dynamodb/index.js +70 -70
  17. package/src/services/dynamodb/server.js +121 -121
  18. package/src/services/dynamodb/simulator.js +620 -614
  19. package/src/services/ecs/index.js +66 -0
  20. package/src/services/ecs/server.js +234 -0
  21. package/src/services/ecs/simulator.js +845 -0
  22. package/src/services/eventbridge/index.js +84 -84
  23. package/src/services/index.js +18 -18
  24. package/src/services/lambda/handler-loader.js +172 -172
  25. package/src/services/lambda/index.js +72 -72
  26. package/src/services/lambda/route-registry.js +274 -274
  27. package/src/services/lambda/server.js +152 -152
  28. package/src/services/lambda/simulator.js +284 -277
  29. package/src/services/s3/index.js +69 -69
  30. package/src/services/s3/server.js +238 -238
  31. package/src/services/s3/simulator.js +740 -740
  32. package/src/services/sns/index.js +75 -75
  33. package/src/services/sqs/index.js +95 -95
  34. package/src/services/sqs/server.js +273 -273
  35. package/src/services/sqs/simulator.js +659 -659
  36. package/src/template/aws-config-template.js +87 -87
  37. package/src/template/aws-config-template.mjs +90 -90
  38. package/src/template/config-template.json +203 -165
  39. package/src/utils/aws-config.js +91 -91
  40. package/src/utils/local-store.js +67 -67
  41. package/src/utils/logger.js +59 -59
@@ -1,88 +1,88 @@
1
- /**
2
- * AWS SDK v3 Configuration for Local Development
3
- * Gerado pelo AWS Local Simulator
4
- */
5
-
6
- const { DynamoDBClient } = require('@aws-sdk/client-dynamodb');
7
- const { DynamoDBDocumentClient } = require('@aws-sdk/lib-dynamodb');
8
- const { S3Client } = require('@aws-sdk/client-s3');
9
- const { SQSClient } = require('@aws-sdk/client-sqs');
10
- const { SNSClient } = require('@aws-sdk/client-sns');
11
- const { EventBridgeClient } = require('@aws-sdk/client-eventbridge');
12
-
13
- // Configurações de ambiente
14
- const isLocal = process.env.IS_LOCAL === 'true' || process.env.NODE_ENV === 'development';
15
-
16
- // Endpoints locais (configuráveis via variáveis de ambiente)
17
- const endpoints = {
18
- dynamodb: process.env.DYNAMODB_ENDPOINT || 'http://localhost:8000',
19
- s3: process.env.S3_ENDPOINT || 'http://localhost:4566',
20
- sqs: process.env.SQS_ENDPOINT || 'http://localhost:9324',
21
- sns: process.env.SNS_ENDPOINT || 'http://localhost:9911',
22
- eventbridge: process.env.EVENTBRIDGE_ENDPOINT || 'http://localhost:4010'
23
- };
24
-
25
- // Credenciais locais
26
- const localCredentials = {
27
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'local',
28
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'local'
29
- };
30
-
31
- const baseConfig = {
32
- region: process.env.AWS_REGION || 'us-east-1',
33
- credentials: isLocal ? localCredentials : undefined
34
- };
35
-
36
- // DynamoDB Client
37
- const dynamoDBClient = new DynamoDBClient({
38
- ...baseConfig,
39
- endpoint: isLocal ? endpoints.dynamodb : undefined
40
- });
41
-
42
- const dynamoDB = DynamoDBDocumentClient.from(dynamoDBClient);
43
-
44
- // S3 Client
45
- const s3 = new S3Client({
46
- ...baseConfig,
47
- endpoint: isLocal ? endpoints.s3 : undefined,
48
- forcePathStyle: isLocal
49
- });
50
-
51
- // SQS Client
52
- const sqs = new SQSClient({
53
- ...baseConfig,
54
- endpoint: isLocal ? endpoints.sqs : undefined
55
- });
56
-
57
- // SNS Client
58
- const sns = new SNSClient({
59
- ...baseConfig,
60
- endpoint: isLocal ? endpoints.sns : undefined
61
- });
62
-
63
- // EventBridge Client
64
- const eventbridge = new EventBridgeClient({
65
- ...baseConfig,
66
- endpoint: isLocal ? endpoints.eventbridge : undefined
67
- });
68
-
69
- module.exports = {
70
- // Clients
71
- dynamoDB,
72
- dynamoDBClient,
73
- s3,
74
- sqs,
75
- sns,
76
- eventbridge,
77
-
78
- // Utilitários
79
- isLocal,
80
- endpoints,
81
-
82
- // Configuração
83
- config: {
84
- region: baseConfig.region,
85
- isLocal,
86
- endpoints
87
- }
1
+ /**
2
+ * AWS SDK v3 Configuration for Local Development
3
+ * Gerado pelo AWS Local Simulator
4
+ */
5
+
6
+ const { DynamoDBClient } = require('@aws-sdk/client-dynamodb');
7
+ const { DynamoDBDocumentClient } = require('@aws-sdk/lib-dynamodb');
8
+ const { S3Client } = require('@aws-sdk/client-s3');
9
+ const { SQSClient } = require('@aws-sdk/client-sqs');
10
+ const { SNSClient } = require('@aws-sdk/client-sns');
11
+ const { EventBridgeClient } = require('@aws-sdk/client-eventbridge');
12
+
13
+ // Configurações de ambiente
14
+ const isLocal = process.env.IS_LOCAL === 'true' || process.env.NODE_ENV === 'development';
15
+
16
+ // Endpoints locais (configuráveis via variáveis de ambiente)
17
+ const endpoints = {
18
+ dynamodb: process.env.DYNAMODB_ENDPOINT || 'http://localhost:8000',
19
+ s3: process.env.S3_ENDPOINT || 'http://localhost:4566',
20
+ sqs: process.env.SQS_ENDPOINT || 'http://localhost:9324',
21
+ sns: process.env.SNS_ENDPOINT || 'http://localhost:9911',
22
+ eventbridge: process.env.EVENTBRIDGE_ENDPOINT || 'http://localhost:4010'
23
+ };
24
+
25
+ // Credenciais locais
26
+ const localCredentials = {
27
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'local',
28
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'local'
29
+ };
30
+
31
+ const baseConfig = {
32
+ region: process.env.AWS_REGION || 'us-east-1',
33
+ credentials: isLocal ? localCredentials : undefined
34
+ };
35
+
36
+ // DynamoDB Client
37
+ const dynamoDBClient = new DynamoDBClient({
38
+ ...baseConfig,
39
+ endpoint: isLocal ? endpoints.dynamodb : undefined
40
+ });
41
+
42
+ const dynamoDB = DynamoDBDocumentClient.from(dynamoDBClient);
43
+
44
+ // S3 Client
45
+ const s3 = new S3Client({
46
+ ...baseConfig,
47
+ endpoint: isLocal ? endpoints.s3 : undefined,
48
+ forcePathStyle: isLocal
49
+ });
50
+
51
+ // SQS Client
52
+ const sqs = new SQSClient({
53
+ ...baseConfig,
54
+ endpoint: isLocal ? endpoints.sqs : undefined
55
+ });
56
+
57
+ // SNS Client
58
+ const sns = new SNSClient({
59
+ ...baseConfig,
60
+ endpoint: isLocal ? endpoints.sns : undefined
61
+ });
62
+
63
+ // EventBridge Client
64
+ const eventbridge = new EventBridgeClient({
65
+ ...baseConfig,
66
+ endpoint: isLocal ? endpoints.eventbridge : undefined
67
+ });
68
+
69
+ module.exports = {
70
+ // Clients
71
+ dynamoDB,
72
+ dynamoDBClient,
73
+ s3,
74
+ sqs,
75
+ sns,
76
+ eventbridge,
77
+
78
+ // Utilitários
79
+ isLocal,
80
+ endpoints,
81
+
82
+ // Configuração
83
+ config: {
84
+ region: baseConfig.region,
85
+ isLocal,
86
+ endpoints
87
+ }
88
88
  };
@@ -1,91 +1,91 @@
1
- /**
2
- * AWS SDK v3 Configuration for Local Development (ES Module)
3
- * Gerado pelo AWS Local Simulator
4
- */
5
-
6
- import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
7
- import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
8
- import { S3Client } from '@aws-sdk/client-s3';
9
- import { SQSClient } from '@aws-sdk/client-sqs';
10
- import { SNSClient } from '@aws-sdk/client-sns';
11
- import { EventBridgeClient } from '@aws-sdk/client-eventbridge';
12
-
13
- // Configurações de ambiente
14
- const isLocal = process.env.IS_LOCAL === 'true' || process.env.NODE_ENV === 'development';
15
-
16
- // Endpoints locais
17
- const endpoints = {
18
- dynamodb: process.env.DYNAMODB_ENDPOINT || 'http://localhost:8000',
19
- s3: process.env.S3_ENDPOINT || 'http://localhost:4566',
20
- sqs: process.env.SQS_ENDPOINT || 'http://localhost:9324',
21
- sns: process.env.SNS_ENDPOINT || 'http://localhost:9911',
22
- eventbridge: process.env.EVENTBRIDGE_ENDPOINT || 'http://localhost:4010'
23
- };
24
-
25
- // Credenciais locais
26
- const localCredentials = {
27
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'local',
28
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'local'
29
- };
30
-
31
- const baseConfig = {
32
- region: process.env.AWS_REGION || 'us-east-1',
33
- credentials: isLocal ? localCredentials : undefined
34
- };
35
-
36
- // DynamoDB Client
37
- const dynamoDBClient = new DynamoDBClient({
38
- ...baseConfig,
39
- endpoint: isLocal ? endpoints.dynamodb : undefined
40
- });
41
-
42
- const dynamoDB = DynamoDBDocumentClient.from(dynamoDBClient);
43
-
44
- // S3 Client
45
- const s3 = new S3Client({
46
- ...baseConfig,
47
- endpoint: isLocal ? endpoints.s3 : undefined,
48
- forcePathStyle: isLocal
49
- });
50
-
51
- // SQS Client
52
- const sqs = new SQSClient({
53
- ...baseConfig,
54
- endpoint: isLocal ? endpoints.sqs : undefined
55
- });
56
-
57
- // SNS Client
58
- const sns = new SNSClient({
59
- ...baseConfig,
60
- endpoint: isLocal ? endpoints.sns : undefined
61
- });
62
-
63
- // EventBridge Client
64
- const eventbridge = new EventBridgeClient({
65
- ...baseConfig,
66
- endpoint: isLocal ? endpoints.eventbridge : undefined
67
- });
68
-
69
- export {
70
- dynamoDB,
71
- dynamoDBClient,
72
- s3,
73
- sqs,
74
- sns,
75
- eventbridge,
76
- isLocal,
77
- endpoints,
78
- baseConfig as config
79
- };
80
-
81
- export default {
82
- dynamoDB,
83
- dynamoDBClient,
84
- s3,
85
- sqs,
86
- sns,
87
- eventbridge,
88
- isLocal,
89
- endpoints,
90
- config: baseConfig
1
+ /**
2
+ * AWS SDK v3 Configuration for Local Development (ES Module)
3
+ * Gerado pelo AWS Local Simulator
4
+ */
5
+
6
+ import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
7
+ import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
8
+ import { S3Client } from '@aws-sdk/client-s3';
9
+ import { SQSClient } from '@aws-sdk/client-sqs';
10
+ import { SNSClient } from '@aws-sdk/client-sns';
11
+ import { EventBridgeClient } from '@aws-sdk/client-eventbridge';
12
+
13
+ // Configurações de ambiente
14
+ const isLocal = process.env.IS_LOCAL === 'true' || process.env.NODE_ENV === 'development';
15
+
16
+ // Endpoints locais
17
+ const endpoints = {
18
+ dynamodb: process.env.DYNAMODB_ENDPOINT || 'http://localhost:8000',
19
+ s3: process.env.S3_ENDPOINT || 'http://localhost:4566',
20
+ sqs: process.env.SQS_ENDPOINT || 'http://localhost:9324',
21
+ sns: process.env.SNS_ENDPOINT || 'http://localhost:9911',
22
+ eventbridge: process.env.EVENTBRIDGE_ENDPOINT || 'http://localhost:4010'
23
+ };
24
+
25
+ // Credenciais locais
26
+ const localCredentials = {
27
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID || 'local',
28
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || 'local'
29
+ };
30
+
31
+ const baseConfig = {
32
+ region: process.env.AWS_REGION || 'us-east-1',
33
+ credentials: isLocal ? localCredentials : undefined
34
+ };
35
+
36
+ // DynamoDB Client
37
+ const dynamoDBClient = new DynamoDBClient({
38
+ ...baseConfig,
39
+ endpoint: isLocal ? endpoints.dynamodb : undefined
40
+ });
41
+
42
+ const dynamoDB = DynamoDBDocumentClient.from(dynamoDBClient);
43
+
44
+ // S3 Client
45
+ const s3 = new S3Client({
46
+ ...baseConfig,
47
+ endpoint: isLocal ? endpoints.s3 : undefined,
48
+ forcePathStyle: isLocal
49
+ });
50
+
51
+ // SQS Client
52
+ const sqs = new SQSClient({
53
+ ...baseConfig,
54
+ endpoint: isLocal ? endpoints.sqs : undefined
55
+ });
56
+
57
+ // SNS Client
58
+ const sns = new SNSClient({
59
+ ...baseConfig,
60
+ endpoint: isLocal ? endpoints.sns : undefined
61
+ });
62
+
63
+ // EventBridge Client
64
+ const eventbridge = new EventBridgeClient({
65
+ ...baseConfig,
66
+ endpoint: isLocal ? endpoints.eventbridge : undefined
67
+ });
68
+
69
+ export {
70
+ dynamoDB,
71
+ dynamoDBClient,
72
+ s3,
73
+ sqs,
74
+ sns,
75
+ eventbridge,
76
+ isLocal,
77
+ endpoints,
78
+ baseConfig as config
79
+ };
80
+
81
+ export default {
82
+ dynamoDB,
83
+ dynamoDBClient,
84
+ s3,
85
+ sqs,
86
+ sns,
87
+ eventbridge,
88
+ isLocal,
89
+ endpoints,
90
+ config: baseConfig
91
91
  };