@gugananuvem/aws-local-simulator 1.0.33 → 1.0.34

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 (79) hide show
  1. package/README.md +834 -834
  2. package/aws-config +153 -153
  3. package/bin/aws-local-simulator.js +63 -63
  4. package/package.json +3 -2
  5. package/src/config/config-loader.js +114 -114
  6. package/src/config/default-config.js +79 -79
  7. package/src/config/env-loader.js +68 -68
  8. package/src/index.js +146 -146
  9. package/src/index.mjs +123 -123
  10. package/src/server.js +463 -463
  11. package/src/services/apigateway/index.js +75 -75
  12. package/src/services/apigateway/server.js +607 -607
  13. package/src/services/apigateway/simulator.js +1405 -1405
  14. package/src/services/athena/index.js +75 -75
  15. package/src/services/athena/server.js +101 -101
  16. package/src/services/athena/simulador.js +998 -998
  17. package/src/services/athena/simulator.js +346 -346
  18. package/src/services/cloudformation/index.js +106 -106
  19. package/src/services/cloudformation/server.js +417 -417
  20. package/src/services/cloudformation/simulador.js +1020 -1020
  21. package/src/services/cloudtrail/index.js +84 -84
  22. package/src/services/cloudtrail/server.js +235 -235
  23. package/src/services/cloudtrail/simulador.js +719 -719
  24. package/src/services/cloudwatch/index.js +84 -84
  25. package/src/services/cloudwatch/server.js +366 -366
  26. package/src/services/cloudwatch/simulador.js +1173 -1173
  27. package/src/services/cognito/index.js +79 -79
  28. package/src/services/cognito/server.js +297 -297
  29. package/src/services/cognito/simulator.js +1992 -1761
  30. package/src/services/config/index.js +96 -96
  31. package/src/services/config/server.js +215 -215
  32. package/src/services/config/simulador.js +1260 -1260
  33. package/src/services/dynamodb/index.js +74 -74
  34. package/src/services/dynamodb/server.js +139 -139
  35. package/src/services/dynamodb/simulator.js +1005 -994
  36. package/src/services/dynamodb/sqlite-store.js +722 -0
  37. package/src/services/ecs/index.js +65 -65
  38. package/src/services/ecs/server.js +235 -235
  39. package/src/services/ecs/simulator.js +844 -844
  40. package/src/services/eventbridge/index.js +89 -89
  41. package/src/services/eventbridge/server.js +209 -209
  42. package/src/services/eventbridge/simulator.js +684 -684
  43. package/src/services/index.js +45 -45
  44. package/src/services/kms/index.js +75 -75
  45. package/src/services/kms/server.js +81 -81
  46. package/src/services/kms/simulator.js +344 -344
  47. package/src/services/lambda/handler-loader.js +183 -183
  48. package/src/services/lambda/index.js +81 -81
  49. package/src/services/lambda/route-registry.js +274 -274
  50. package/src/services/lambda/server.js +191 -191
  51. package/src/services/lambda/simulator.js +364 -364
  52. package/src/services/parameter-store/index.js +80 -80
  53. package/src/services/parameter-store/server.js +50 -50
  54. package/src/services/parameter-store/simulator.js +201 -201
  55. package/src/services/s3/index.js +73 -73
  56. package/src/services/s3/server.js +350 -350
  57. package/src/services/s3/simulator.js +568 -568
  58. package/src/services/secret-manager/index.js +80 -80
  59. package/src/services/secret-manager/server.js +51 -51
  60. package/src/services/secret-manager/simulator.js +182 -182
  61. package/src/services/sns/index.js +89 -89
  62. package/src/services/sns/server.js +607 -607
  63. package/src/services/sns/simulator.js +1482 -1482
  64. package/src/services/sqs/index.js +98 -98
  65. package/src/services/sqs/server.js +360 -360
  66. package/src/services/sqs/simulator.js +509 -509
  67. package/src/services/sts/index.js +37 -37
  68. package/src/services/sts/server.js +144 -144
  69. package/src/services/sts/simulator.js +69 -69
  70. package/src/services/xray/index.js +83 -83
  71. package/src/services/xray/server.js +308 -308
  72. package/src/services/xray/simulador.js +994 -994
  73. package/src/template/aws-config-template.js +87 -87
  74. package/src/template/aws-config-template.mjs +90 -90
  75. package/src/template/config-template.json +203 -203
  76. package/src/utils/aws-config.js +91 -91
  77. package/src/utils/cloudtrail-audit.js +129 -129
  78. package/src/utils/local-store.js +83 -83
  79. package/src/utils/logger.js +59 -59
@@ -1,106 +1,106 @@
1
- 'use strict';
2
-
3
- /**
4
- * @fileoverview CloudFormation Service
5
- * Porta padrão: 4580
6
- */
7
-
8
- const http = require('http');
9
- const path = require('path');
10
- const { CloudFormationSimulator } = require('./simulador');
11
- const { createCloudFormationServer } = require('./server');
12
- const LocalStore = require('../../utils/local-store');
13
-
14
- class CloudFormationService {
15
- constructor(config) {
16
- this.config = config;
17
- this.logger = require('../../utils/logger');
18
- this.name = 'cloudformation';
19
- this.port = config?.ports?.cloudformation || config?.services?.cloudformation?.port || 4580;
20
- this.store = null;
21
- this.simulator = null;
22
- this._server = null;
23
- this.isRunning = false;
24
- }
25
-
26
- async initialize() {
27
- this.logger.debug(`Inicializando CloudFormation Service na porta ${this.port}...`);
28
- const dataDir = process.env.AWS_LOCAL_SIMULATOR_DATA_DIR;
29
- this.store = new LocalStore(path.join(dataDir, 'cloudformation'));
30
- this.simulator = new CloudFormationSimulator(this.config, this.store, this.logger);
31
- await this.simulator.load();
32
- this.logger.debug('CloudFormation Service inicializado');
33
- }
34
-
35
- injectDependencies(server) {
36
- const ct = server.getService('cloudtrail');
37
- if (ct?.simulator) this.simulator.audit.setTrail(ct.simulator);
38
-
39
- const s3 = server.getService('s3');
40
- if (s3?.simulator) this.simulator.s3Simulator = s3.simulator;
41
-
42
- const sqs = server.getService('sqs');
43
- if (sqs?.simulator) this.simulator.sqsSimulator = sqs.simulator;
44
-
45
- const dynamo = server.getService('dynamodb');
46
- if (dynamo?.simulator) this.simulator.dynamoSimulator = dynamo.simulator;
47
-
48
- const kms = server.getService('kms');
49
- if (kms?.simulator) this.simulator.kmsSimulator = kms.simulator;
50
-
51
- const secrets = server.getService('secret-manager');
52
- if (secrets?.simulator) this.simulator.secretsSimulator = secrets.simulator;
53
-
54
- const params = server.getService('parameter-store');
55
- if (params?.simulator) this.simulator.parameterStoreSimulator = params.simulator;
56
-
57
- const athena = server.getService('athena');
58
- if (athena?.simulator) this.simulator.athenaSimulator = athena.simulator;
59
- }
60
-
61
- async start() {
62
- if (this.isRunning) return;
63
- const app = createCloudFormationServer(this.simulator, this.config, this.logger);
64
- this._server = http.createServer(app);
65
- return new Promise((resolve, reject) => {
66
- this._server.listen(this.port, () => {
67
- this.isRunning = true;
68
- this.logger.debug(`CloudFormation rodando na porta ${this.port}`);
69
- resolve();
70
- });
71
- this._server.once('error', reject);
72
- });
73
- }
74
-
75
- async stop() {
76
- if (!this.isRunning || !this._server) return;
77
- return new Promise((resolve, reject) => {
78
- this._server.close((err) => {
79
- if (err) return reject(err);
80
- this.isRunning = false;
81
- resolve();
82
- });
83
- });
84
- }
85
-
86
- async reset() {
87
- await this.simulator.reset();
88
- }
89
-
90
- getStatus() {
91
- const stats = this.simulator?.getStats() || {};
92
- return {
93
- running: this.isRunning,
94
- port: this.port,
95
- endpoint: `http://localhost:${this.port}`,
96
- ...stats,
97
- };
98
- }
99
-
100
- getSimulator() { return this.simulator; }
101
-
102
- async createStack(params) { return this.simulator.createStack(params); }
103
- describeStacks(params) { return this.simulator.describeStacks(params); }
104
- }
105
-
106
- module.exports = CloudFormationService;
1
+ 'use strict';
2
+
3
+ /**
4
+ * @fileoverview CloudFormation Service
5
+ * Porta padrão: 4580
6
+ */
7
+
8
+ const http = require('http');
9
+ const path = require('path');
10
+ const { CloudFormationSimulator } = require('./simulador');
11
+ const { createCloudFormationServer } = require('./server');
12
+ const LocalStore = require('../../utils/local-store');
13
+
14
+ class CloudFormationService {
15
+ constructor(config) {
16
+ this.config = config;
17
+ this.logger = require('../../utils/logger');
18
+ this.name = 'cloudformation';
19
+ this.port = config?.ports?.cloudformation || config?.services?.cloudformation?.port || 4580;
20
+ this.store = null;
21
+ this.simulator = null;
22
+ this._server = null;
23
+ this.isRunning = false;
24
+ }
25
+
26
+ async initialize() {
27
+ this.logger.debug(`Inicializando CloudFormation Service na porta ${this.port}...`);
28
+ const dataDir = process.env.AWS_LOCAL_SIMULATOR_DATA_DIR;
29
+ this.store = new LocalStore(path.join(dataDir, 'cloudformation'));
30
+ this.simulator = new CloudFormationSimulator(this.config, this.store, this.logger);
31
+ await this.simulator.load();
32
+ this.logger.debug('CloudFormation Service inicializado');
33
+ }
34
+
35
+ injectDependencies(server) {
36
+ const ct = server.getService('cloudtrail');
37
+ if (ct?.simulator) this.simulator.audit.setTrail(ct.simulator);
38
+
39
+ const s3 = server.getService('s3');
40
+ if (s3?.simulator) this.simulator.s3Simulator = s3.simulator;
41
+
42
+ const sqs = server.getService('sqs');
43
+ if (sqs?.simulator) this.simulator.sqsSimulator = sqs.simulator;
44
+
45
+ const dynamo = server.getService('dynamodb');
46
+ if (dynamo?.simulator) this.simulator.dynamoSimulator = dynamo.simulator;
47
+
48
+ const kms = server.getService('kms');
49
+ if (kms?.simulator) this.simulator.kmsSimulator = kms.simulator;
50
+
51
+ const secrets = server.getService('secret-manager');
52
+ if (secrets?.simulator) this.simulator.secretsSimulator = secrets.simulator;
53
+
54
+ const params = server.getService('parameter-store');
55
+ if (params?.simulator) this.simulator.parameterStoreSimulator = params.simulator;
56
+
57
+ const athena = server.getService('athena');
58
+ if (athena?.simulator) this.simulator.athenaSimulator = athena.simulator;
59
+ }
60
+
61
+ async start() {
62
+ if (this.isRunning) return;
63
+ const app = createCloudFormationServer(this.simulator, this.config, this.logger);
64
+ this._server = http.createServer(app);
65
+ return new Promise((resolve, reject) => {
66
+ this._server.listen(this.port, () => {
67
+ this.isRunning = true;
68
+ this.logger.debug(`CloudFormation rodando na porta ${this.port}`);
69
+ resolve();
70
+ });
71
+ this._server.once('error', reject);
72
+ });
73
+ }
74
+
75
+ async stop() {
76
+ if (!this.isRunning || !this._server) return;
77
+ return new Promise((resolve, reject) => {
78
+ this._server.close((err) => {
79
+ if (err) return reject(err);
80
+ this.isRunning = false;
81
+ resolve();
82
+ });
83
+ });
84
+ }
85
+
86
+ async reset() {
87
+ await this.simulator.reset();
88
+ }
89
+
90
+ getStatus() {
91
+ const stats = this.simulator?.getStats() || {};
92
+ return {
93
+ running: this.isRunning,
94
+ port: this.port,
95
+ endpoint: `http://localhost:${this.port}`,
96
+ ...stats,
97
+ };
98
+ }
99
+
100
+ getSimulator() { return this.simulator; }
101
+
102
+ async createStack(params) { return this.simulator.createStack(params); }
103
+ describeStacks(params) { return this.simulator.describeStacks(params); }
104
+ }
105
+
106
+ module.exports = CloudFormationService;